Complete the code to define a primary key on the 'id' column.
CREATE TABLE users (id INT [1], name VARCHAR(100));
The PRIMARY KEY constraint uniquely identifies each record in a table.
Complete the code to add a unique constraint on the 'email' column.
ALTER TABLE users ADD CONSTRAINT unique_email [1] (email);The UNIQUE constraint ensures all values in the 'email' column are different.
Fix the error in the code to correctly define a composite primary key on 'order_id' and 'product_id'.
CREATE TABLE order_items (order_id INT, product_id INT, quantity INT, PRIMARY KEY ([1]));A composite primary key uses multiple columns to uniquely identify a record.
Fill both blanks to create a table with a unique constraint on 'username' and a primary key on 'user_id'.
CREATE TABLE accounts (user_id INT [1], username VARCHAR(50) [2]);
The 'user_id' column is the primary key, and 'username' must be unique.
Fill all three blanks to add a primary key and unique constraint using table-level constraints.
CREATE TABLE products (product_id INT, name VARCHAR(100), sku VARCHAR(50), CONSTRAINT [1] PRIMARY KEY ([2]), CONSTRAINT [3] UNIQUE (sku));
Table-level constraints are named and specify primary key and unique constraints separately.