Skip to content
Chapter Practice Arena

Database Design Problems

Targeted practice challenges specifically curated for this chapter. Inspect hints, verify outputs, and check verified solutions.

All Chapters
Filter by Language:9 Problems
Filter by SQL Chapter:
Difficulty:
Chapter:
Showing 6 challenges · 9 total · Page 1 of 2
7. Retrieve Related Data with JOIN
Starter Code
-- Practice query for Database Relationships: One-to-One, One-to-Many, and Many-to-Many
Expected Output
Formatted Result
student_namecourse_name
AshaSQL
AshaPython
RaviSQL
3 rows returned2 columns
6. Combine Constraints in a Realistic Table
Starter Code
-- Practice query for Constraints: NOT NULL, UNIQUE, CHECK, and DEFAULT
Expected Output
One customer row is returned. customer_id is generated by PostgreSQL, account_status defaults to 'active', and created_at receives the current timestamp. The exact ID and timestamp depend on the database state and execution time.
10. Practice Exercises
Starter Code
-- Practice query for Constraints: NOT NULL, UNIQUE, CHECK, and DEFAULT
Expected Output
One row is returned with sku INV-100, item_name USB Hub, unit_price 799.00, quantity 0, and item_status active. The generated item_id depends on the table's identity sequence state.
13. Practice Exercises
Starter Code
-- Practice query for Database Relationships: One-to-One, One-to-Many, and Many-to-Many
Expected Output
The query returns one row per author-book relationship. Exact results depend on which authors, books, and relationships have been inserted.
9. Practice Exercises
Starter Code
-- Practice query for First, Second, and Third Normal Forms
Expected Output
The schema stores order dates with orders, product names with products, and quantities with individual order-product associations.
#6intermediateDatabase Normalization
12. Practice Exercises
Starter Code
-- Practice query for Database Normalization
Expected Output
The design stores each department name once and references its department from employee rows. The nullable foreign key allows an employee to have no assigned department.