Complete the code to find all names starting with 'A'.
SELECT name FROM users WHERE name [1] 'A%';
The LIKE operator is used for pattern matching in SQL. Here, 'A%' means names starting with 'A'.
Complete the code to find all emails containing 'example' regardless of case.
SELECT email FROM contacts WHERE email [1] '%example%';
The ILIKE operator works like LIKE but ignores case, so it finds 'example' anywhere in the email regardless of uppercase or lowercase.
Fix the error in the query to find usernames ending with digits.
SELECT username FROM users WHERE username [1] '%[0-9]';
The SIMILAR TO operator supports SQL regular expressions, so '%[0-9]' matches strings ending with a digit. LIKE does not support character classes like [0-9].
Fill both blanks to find product codes starting with 'X' and ending with 'Z' ignoring case.
SELECT code FROM products WHERE code [1] '[2]';
Using ILIKE makes the match case-insensitive. The pattern 'X%Z' means the code starts with 'X' and ends with 'Z' with any characters in between.
Fill all three blanks to select all rows where description contains 'sale' case-insensitively and price is greater than 100.
SELECT * FROM items WHERE description [1] '%[2]%' AND price [3] 100;
ILIKE is used for case-insensitive pattern matching. The pattern '%sale%' finds 'sale' anywhere in the description. The operator '>' filters prices greater than 100.