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 the table.
Complete the code to add a primary key constraint named 'pk_order_id' on 'order_id'.
ALTER TABLE orders ADD CONSTRAINT [1] PRIMARY KEY (order_id);The constraint name for a primary key often starts with pk_ to indicate its purpose.
Fix the error in the code to correctly declare a composite primary key on 'id' and 'email'.
CREATE TABLE contacts (id INT, email VARCHAR(255), [1] pk_contacts PRIMARY KEY (id, email));
Composite primary keys require the CONSTRAINT keyword before naming or defining the key.
Fill both blanks to create a table 'products' with 'product_id' as primary key and 'name' not null.
CREATE TABLE products (product_id INT [1], name VARCHAR(100) [2]);
The product_id column is the primary key, and name must not be null.
Fill all three blanks to add a primary key constraint named 'pk_emp' on 'emp_id' in the 'employees' table.
ALTER TABLE employees ADD [1] pk_emp [2] [3] (emp_id);
The syntax to add a named primary key constraint is: ADD CONSTRAINT pk_emp PRIMARY KEY (emp_id).