Complete the code to create a unique index on the column 'email' in the 'users' table.
CREATE UNIQUE INDEX [1] ON users(email);The index name idx_email_unique clearly indicates it is a unique index on the email column.
Complete the code to insert a new user with email 'test@example.com' into the 'users' table.
INSERT INTO users (name, email) VALUES ('Alice', [1]);
The email 'test@example.com' matches the requirement for this insertion.
Fix the error in the query to select all users with unique emails.
SELECT * FROM users WHERE email [1] (SELECT email FROM users GROUP BY email HAVING COUNT(*) = 1);
The IN operator is used to check if the email is in the list of emails that appear only once.
Fill both blanks to create a unique index on 'username' and 'email' columns in the 'accounts' table.
CREATE UNIQUE INDEX [1] ON accounts([2]);
The index name idx_username_email_unique is descriptive. The columns username, email are both included for uniqueness.
Fill all three blanks to select emails that appear more than once in the 'subscribers' table.
SELECT [1], COUNT([2]) FROM subscribers GROUP BY [3] HAVING COUNT(email) > 1;
Select the email column, count all rows with *, and group by email to find duplicates.