Complete the code to make the email column not accept empty values.
CREATE TABLE users (id SERIAL PRIMARY KEY, email VARCHAR(255) [1]);
The NOT NULL constraint ensures that the email column cannot have empty (NULL) values.
Complete the code to ensure the username column has unique values.
CREATE TABLE accounts (id SERIAL PRIMARY KEY, username VARCHAR(50) [1]);
The UNIQUE constraint ensures that no two rows have the same username value.
Fix the error in the age column to allow only ages 18 or older.
CREATE TABLE members (id SERIAL PRIMARY KEY, age INT [1] (age >= 18));
The CHECK constraint with condition age >= 18 restricts values to 18 or older.
Fill both blanks to create a price column that cannot be empty and must be positive.
CREATE TABLE products (id SERIAL PRIMARY KEY, price NUMERIC [1] [2] (price > 0));
NOT NULL ensures price is not empty, and CHECK (price > 0) ensures it is positive.
Fill all three blanks to create a user_id column that is unique, not empty, and must be greater than zero.
CREATE TABLE orders (order_id SERIAL PRIMARY KEY, user_id INT [1] [2] [3] (user_id > 0));
UNIQUE ensures no duplicate user_id, NOT NULL prevents empty values, and CHECK (user_id > 0) ensures positive values.