About the “Feature Matrix Generation with CROSS JOIN” SQL Problem
Business Scenario
Product operations needs a full Cartesian entitlement grid mapping every subscription plan tier to every available feature toggle, marking whether the feature is currently enabled.
Expected Output & Criteria
Complete plan-to-feature matrix with enabled status flag.
Database Table Schema (PostgreSQL DDL)
PostgreSQL 16 WASMThis challenge executes directly against the following relational schema in your browser:
CREATE TABLE plans (
plan_id INT PRIMARY KEY,
plan_name VARCHAR(50) NOT NULL
);
CREATE TABLE features (
feature_id INT PRIMARY KEY,
feature_key VARCHAR(50) NOT NULL
);
CREATE TABLE plan_entitlements (
plan_id INT REFERENCES plans(plan_id),
feature_id INT REFERENCES features(feature_id),
enabled BOOLEAN NOT NULL,
PRIMARY KEY (plan_id, feature_id)
);Target SQL Clauses & Operators
CROSS JOINLEFT JOINORDER BY
Want more Joins practice?
Explore the full syllabus of 12 exercises, syntax guides, and interview pitfalls.