Complete the code to select all rows where age is equal to 30.
SELECT * FROM users WHERE age [1] 30;
The equal sign = is used to compare if two values are the same.
Complete the code to select all rows where salary is greater than 50000.
SELECT * FROM employees WHERE salary [1] 50000;
The greater than operator > selects values larger than the given number.
Fix the error in the code to select rows where score is not equal to 100.
SELECT * FROM results WHERE score [1] 100;
== causes syntax errors in SQL.= selects rows equal to 100, not different.In MySQL, the not equal operator can be written as <> or !=. Both are valid, but <> is often preferred for compatibility.
Fill both blanks to select rows where price is between 10 and 20 (inclusive).
SELECT * FROM products WHERE price [1] 10 AND price [2] 20;
> or < excludes the boundary values.To select prices between 10 and 20 including both, use >= for the lower bound and <= for the upper bound.
Fill all three blanks to select rows where quantity is greater than 5, less than 15, and not equal to 10.
SELECT * FROM inventory WHERE quantity [1] 5 AND quantity [2] 15 AND quantity [3] 10;
= instead of != will select quantity equal to 10.This query selects quantities greater than 5, less than 15, and not equal to 10 using >, <, and != operators respectively.