Problem: Design Better Tables

Redesign a books table that includes the basic structure:

  • Have an id column that is an INTEGER and a PRIMARY KEY.

  • Have a title column that is TEXT and cannot be empty (NOT NULL).

  • Have a pages column that only allows values greater than 0 using a CHECK constraint.

Problem: Design Better Tables

Redesign a books table that includes the basic structure:

  • Have an id column that is an INTEGER and a PRIMARY KEY.

  • Have a title column that is TEXT and cannot be empty (NOT NULL).

  • Have a pages column that only allows values greater than 0 using a CHECK constraint.

MySQL
# Write your query here: