Complete the code to create a table where the 'name' column cannot be empty.
CREATE TABLE users (id INT, name VARCHAR(100) [1]);
The NOT NULL constraint ensures that the 'name' column must have a value and cannot be left empty.
Complete the INSERT statement to add a user with a non-empty 'email' field that has a NOT NULL constraint.
INSERT INTO users (id, email) VALUES (1, [1]);
You must provide a valid non-null value for the 'email' column because it has a NOT NULL constraint. Using 'user@example.com' is correct.
Fix the error in the table creation by adding the correct constraint to the 'age' column to prevent NULL values.
CREATE TABLE people (id INT, age INT [1]);The NOT NULL constraint ensures the 'age' column cannot have NULL values, fixing the error.
Fill both blanks to create a table where 'username' cannot be NULL and has a default value 'guest'.
CREATE TABLE accounts (id INT, username VARCHAR(50) [1] [2]);
The NOT NULL constraint prevents NULL values, and DEFAULT 'guest' sets a default username if none is provided.
Fill all three blanks to insert a new row with id 10, a non-null name, and a default age in the 'persons' table.
INSERT INTO persons (id, name, age) VALUES ([1], [2], [3]);
We insert 10 for id, a non-null name 'Alice', and use DEFAULT for age to apply the default value.