SQL Usage Flashcards
What is a field also known as?
An attribute
What is a row also called?
A record
SQL keywords are ____ case sensitive
NOT
SQL SELECT specific columns
SELECT column1, column2, …
FROM table_name;
Select ALL columns
SELECT * FROM table_name;
SQL SELECT DISTINCT Statement
SELECT DISTINCT column1, column2, …
FROM table_name;
Count Distinct
SELECT COUNT(DISTINCT column_name) FROM table_name;
The SQL WHERE Clause
SELECT column1, column2, …
FROM table_name
WHERE condition;
Operators that can be used with WHERE clause (9)
=
>
<
>=
<=
<> (!= - in some SQL versions)
BETWEEN x AND Y
LIKE
IN
SQL ORDER BY
SELECT column1, column2, …
FROM table_name
ORDER BY column1, column2, … ASC|DESC;
SQL AND Operator
SELECT column1, column2, …
FROM table_name
WHERE condition1 AND condition2 AND condition3 …;
SQL OR Operator
SELECT column1, column2, …
FROM table_name
WHERE condition1 OR condition2 OR condition3 …;
NOT Operator
SELECT column1, column2, …
FROM table_name
WHERE NOT condition;
SQL INSERT INTO
INSERT INTO table_name (column1, column2, column3, …)
VALUES (value1, value2, value3, …);
or
INSERT INTO table_name
VALUES (value1, value2, value3, …);
IS NULL Syntax
SELECT column_names
FROM table_name
WHERE column_name IS NULL;