Programming Terms
What is LIMIT?
A clause that lets you specify the maximum number of rows the result set 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
What is the correct query to select only the cities with temperatures less than 35?
SELECT * FROM cities WHERE temperature <35;
How would you query all the unique genres from the books table?
SELECT DISTINCT genres FROM books;
Which operatory would you use to query values that meet ALL conditions in a WHERE clause?
AND
Find the error in this code: SELECE name, CASE WHEN imdb_rating >8 THEN 'Oscar' WHEN imdb_rating >7 THEN 'Good' WHEN imdb_rating >6 THEN 'Fair' FROM movies;
Missed END
IS NULL condition return true if the field is empty.
TRUE
LIKE and BETWEEN
are special operators
AND and OR
combines multiple conditions
CASE
creates different outputs
WHERE
is a popular command that lets you filter the results of the query based on conditions that you specify
SELECT
is the clause we use everytime we want to query information from a database.
What does the wildcard character % in the following SQL statement do? SELECT * FROM sports WHERE name LIKE '%ball';
it matches all sports that end with 'ball'
What is the correct syntax to query both the name and date columns from the database? SELECT _____________ FROM album;
name, date
AS
renames a column or table
DISTINCT
return unique values
ORDER BY
sorts the result
LIMIT
specifies the maximum number of rows that they query will return
Which of the following is NOT a comparison operator in SQL?
~ Comparison operators are =, !=, >, <, >=, <=.