Complete the code to create a table with a primary key constraint.
CREATE TABLE employees (id INT [1], name VARCHAR(100));
The PRIMARY KEY constraint uniquely identifies each record in the table.
Complete the code to add a NOT NULL constraint to the email column.
CREATE TABLE users (user_id INT PRIMARY KEY, email VARCHAR(255) [1]);
The NOT NULL constraint ensures that the email column cannot have empty values.
Fix the error in the constraint syntax to ensure age is always 18 or older.
CREATE TABLE members (member_id INT PRIMARY KEY, age INT CHECK (age [1] 18));
The CHECK constraint with >= 18 ensures age is 18 or older.
Fill both blanks to create a foreign key constraint linking orders to customers.
CREATE TABLE orders (order_id INT PRIMARY KEY, customer_id INT, CONSTRAINT fk_customer FOREIGN KEY ([1]) REFERENCES [2](id));
The foreign key customer_id in orders references the id in customers table.
Fill all three blanks to create a table with a unique constraint and a default value.
CREATE TABLE products (product_id INT PRIMARY KEY, sku VARCHAR(50) [1], stock INT [2] 0, CONSTRAINT unique_sku [3] (sku));
The sku column has a UNIQUE constraint to avoid duplicates, stock has a DEFAULT value of 0, and the constraint named unique_sku enforces uniqueness on sku.