1/19
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
What is the basic form of the SQL SELECT command
SELECT-FROM-WHERE. Specify the columns to be listed after the word SELECT (or asterisk (*) to select all columns). Then specify the table name after the work FROM. Optionally, you can include one or more conditions after the word WHERE.
How are simple conditions written?
Column name, comparison operator, column name or value.
What comparison operators can be used with simple conditions?
=,>,>=,<,<=,<>, or !=
How are compound conditions formed?
By combining simple conditions using the AND, OR, and NOT operators
BETWEEN operator
Indicates a range of values in a condition. Also used to determine whether a value is between two other values without using an AND condition.
How do you use computed columns in SQL commands?
By using arithmetic operators an writing the computation in place of a column name
How do you assign a name to a computed column?
Follow the computation with the word AS and then the name
LIKE operator
Used to check for a value in a character column that is similar to a particular string of characters
Use of (%), ( _ ) wildcards
The percent (%) wildcard represents any collection of characters. The underscore ( _ ) wildcard represents any single character.
IN operator
Used to determine whether a column contains a value in a set of values
Aggregate functions COUNT, SUM, AVG, MAX, and MIN
SQL processes these aggregate functions to calculate values for groups of rows
What command do you use to sort data?
Use an ORDER BY clause
What is a Major Sort Key (or the Primary Sort Key)
The more important column when sorting data on two columns
What is a Minor Sort Key (or the Secondary Sort Key)
The less important column when sorting data on two columns
How do you sort data in descending order?
Follow the sort key with the DESC operator
How do you avoid including duplicate values in a query's result?
To avoid duplicates, precede the column name with the DISTINCT operator
What is a subquery?
When one SQL query is placed inside another, it is called a subquery.
How do you find rows in which a particular column contains a null value?
Use the IS NULL operator in the WHERE clause
How do you group data in a SQL query?
Use a GROUP BY clause
When grouping data in a query, how do you restrict the output to only those groups satisfying some condition?
Use a HAVING clause to restrict the output to certain groups.