Filter Queries, Operators, and Wildcards Flashcards
(19 cards)
What do SELECT DISTINCT statements do?
return unique values by filtering out duplicates
What is the basic SELECT DISTINCT statement format?
SELECT DISTINCT column_name FROM table_name;
What do WHERE statements do?
filter result set to include ONLY row that meet the following conditions
What is the basic WHERE statement format?
SELECT * FROM table_name WHERE column_name condition;
What do operators do?
symbols that create a condition
What are 6 operators and their symbol?
= Equals
!= Not Equals
> Greater Than
= Greater Than or Equal To
What do LIKE statements do?
return similar values for comparison
What is the basic LIKE statement format?
SELECT * FROM table_name WHERE column_name LIKE value;
What do wildcard characters do?
donate that any character can be placed in the location without breaking the pattern
What does the _ wildcard character do?
Allows any one character to replace the symbol
Example, ‘Se_en’ could return “Seven” or “Se7en”
What does the % wildcard character do?
Any number of characters can replace the symbol, so long as the value ends or begins with the correct character
Example, ‘a%’ could return ‘apple’ or ‘Andrew’
Example 2, ‘%man%’ could return ‘man’, ‘Manitoba’, or ‘woman’
What do BETWEEN statements do?
return the results between two values, when used with WHERE statements
What is the basic BETWEEN statement format?
SELECT * FROM table_name WHERE column_name BETWEEN value AND value;
What do AND statements do?
join conditions for a query; all conditions must be true for a row to show for the query
What do OR statements do?
join conditions for a query; one or more conditions must be true for a row to show for the query
What do ORDER BY statements do?
indicate that a column should be sorted alphabetically or numerically
What do DESC statements do?
indicate sorting a column in descending order, when used with ORDER BY
What do ASC statements do?
indicate sorting a column in ascending order, when used with ORDER BY
What do LIMIT statements do?
limit the results by a certain number
i.e., top 3 results or first 10 rows