w3resource

Database Design and Normalization Exercises with Solutions


Database Design and Normalization Exercises with solutions [20 exercises with solution]

1. Designing a Table in First Normal Form (1NF)

Write a SQL query to normalize a table into First Normal Form (1NF).

Click me to see the solution

2. Resolving Partial Dependencies for Second Normal Form (2NF)

Write a SQL query to resolve partial dependencies and achieve 2NF.

Click me to see the solution

3. Eliminating Transitive Dependencies for Third Normal Form (3NF)

Write a SQL query to eliminate transitive dependencies and achieve 3NF.

Click me to see the solution

4. Achieving Boyce-Codd Normal Form (BCNF)

Write a SQL query to resolve overlapping candidate keys and achieve BCNF.

Click me to see the solution

5. Identifying and Resolving Update Anomalies

Write a SQL query to identify and resolve update anomalies in a poorly designed table.

Click me to see the solution

6. Designing a Junction Table for Many-to-Many Relationships

Write a SQL query to design a junction table for a many-to-many relationship.

Click me to see the solution

7. Denormalizing for Performance Optimization

Write a SQL query to denormalize a database for improved query performance.

Click me to see the solution

8. Designing a Surrogate Key for Entity Identification

Write a SQL query to design a surrogate key for entity identification.

Click me to see the solution

9. Resolving Insertion Anomalies in Database Design

Write a SQL query to resolve insertion anomalies in a poorly designed table.

Click me to see the solution

10. Designing a Star Schema for Data Warehousing

Write a SQL query to design a star schema for a data warehouse.

Click me to see the solution

11. Resolving Deletion Anomalies in Database Design

Write a SQL query to resolve deletion anomalies in a poorly designed table.

Click me to see the solution

12. Designing a Composite Key for Multi-Attribute Relationships

Write a SQL query to design a composite key for a table with multi-attribute relationships.

Click me to see the solution

13. Identifying Functional Dependencies in a Table

Write a SQL query to identify functional dependencies in a table.

Click me to see the solution

14. Designing a Recursive Relationship for Hierarchical Data

Write a SQL query to design a recursive relationship for hierarchical data.

Click me to see the solution

15. Designing a Weak Entity for Dependent Data

Write a SQL query to design a weak entity for dependent data.

Click me to see the solution

16. Designing a Lookup Table for Categorical Data

Write a SQL query to design a lookup table for categorical data.

Click me to see the solution

17. Designing a History Table for Auditing Changes

Write a SQL query to design a history table for auditing changes to a main table.

Click me to see the solution

18. Designing a Partitioned Table for Large Datasets

Write a SQL query to design a partitioned table for large datasets.

Click me to see the solution

19. Designing a Polymorphic Association for Flexible Relationships

Write a SQL query to design a polymorphic association for flexible relationships.

Click me to see the solution

20. Designing a Temporal Table for Time-Based Data Tracking

Write a SQL query to design a temporal table for tracking time-based data changes.

Click me to see the solution

More to Come !

Do not submit any solution of the above exercises at here, if you want to contribute go to the appropriate exercise page.



Follow us on Facebook and Twitter for latest update.