SQL
What is LIMIT?
A clause that lets you specify the maximum number of rows the result will have.
What is ORDER BY?
A clause that sorts the result set alphabetically or numerically
What is LIKE?
A special operator that can be used with the WHERE clause to search for a pattern.
What code would you add to this query to order colors by name alphabetically (Z to A)? SELECT * FROM colors _________________;
ORDER BY name DESC;
Which operator would you use to query values that meet all conditions in a WHERE clause?
AND
What does the wildcard character % in the following SQL statement do? SELECT * FROM sports WHERE name LIKE '%ball';
It matches all sports that ends with 'ball'
Find the error in this code: what statement is missing? SELECT name, CASE WHEN imdb_rating > 8 THEN 'Oscar' WHEN imdb_rating > 7 THEN 'Good' WHEN imdb_rating > 6 THEN 'Fair' FROM movies;
Missing END statement
IS NULL condition returns true if the field is empty. TRUE or FALSE?
TRUE
How would you query all the unique genres from the books table? a. SELECT DISTINCT genres FROM books; b. SELECT UNIQUE genres FROM books; c. FROM books SELECT DISTINCT genres; d. SELECT genres FROM books;
a. SELECT DISTINCT genres FROM books;
What is the correct query to select only the cities with temperatures less than 35? a. SELECT * FROM cities WHERE temperature != 35; b. SELECT * FROM cities WHERE temperature < 35; c. SELECT * FROM cities; d. SELECT * FROM cities WHERE temperature = 35;
b. SELECT * FROM cities WHERE temperature < 35;
Which of the following is NOT a comparison operator in SQL? a. != b. >= c. ~ d. <
c. ~
What is the correct syntax to query both the name and date columns from the database? SELECT __________ FROM album;
name, date