SQL Flashcards

1
Q

vertical bar | meaning

bar meaning

A

OR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

curly brackets {…} meaning

A

indicates a required element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

square bracket […] meaning

A

indicate an optional element or optional repetition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

SELECT description

A

selects specific columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

FROM description

A

specifies the table(s)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

WHERE description

A

filters individual rows that are subject to some condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

GROUP BY description

A

groups together rows with same column name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

HAVING description

A

filters groups that are subject to some condition

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

ORDER BY description

A

specifies the order of the output

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

SELECT everything query

A

SELECT (*) FROM table;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

IS NULL description

A

to test for empty values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

IS NOT NULL description

A

to test for non-empty values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

SELECT DISTINCT description

A

selects columns without the repetitive values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

AS description

A

renames a column

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

LIKE description

A

to search for a specified pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

% meaning

A

0 or more characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

_ meaning

A

any single character

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

e.g S% meaning

A

any string starting with the letter “S”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

e.g S_ _ _ _

A

any 5 letter string starting with “S”

20
Q

e.g %S

A

any string ending with the letter “S”

21
Q

NOT LIKE description

A

to filter a pattern out

22
Q

ASC keyword

A

to specify ascending order

23
Q

DESC keyword

A

to specify descending order

24
Q

INSERT values into a table query

A

INSERT INTO table(column) VALUES (‘values’);

25
INSERT columns into another table query
INSERT INTO table2 SELECT column FROM table1 WHERE condition;
26
UPDATE query
UPDATE table SET column1 = value1 WHERE condition;
27
SET description
specifies names of 1 or more columns that are to be updated
28
DELETE query
DELETE FROM table WHERE condition;
29
COUNT description
returns number of rows that match the specified criterion
30
SUM description
returns sum of values in specified column
31
AVG description
returns average value in the specified column
32
MIN description
returns lowest value in specified column
33
MAX description
returns highest value in specified column
34
Which SQL aggregate functions can only apply to numeric and non-numeric fields?
COUNT, MIN, MAX
35
Which SQL aggregate functions can only apply to numeric fields?
SUM and AVG
36
DISTINCT has no effect with ___/___ but may have with ___/___
MIN/MAX, SUM/AVG
37
SELECT DISTINCT query
SELECT DISTINCT column FROM table;
38
AS query
SELECT columnName AS newName FROM table;
39
COUNT query
SELECT COUNT (column) FROM table WHERE condition;
40
SUM query
SELECT SUM (column) FROM table WHERE condition;
41
AVG query
SELECT AVG (column) FROM table WHERE condition;
42
GROUP UP query
SELECT column FROM table WHERE condition GROUP BY column;
43
HAVING query
SELECT column FROM table WHERE condition HAVING condition;
44
ORDER BY query
SELECT * FROM table ORDER BY column;
45
ASC|DESC query
SELECT column FROM table ORDER BY column ASC|DESC
46
IS NULL|IS NOT NULL query
SELECT column1 FROM table WHERE column2 IS NULL | IS NOT NULL;
47
LIKE|NOT LIKE query
SELECT column1 FROM table WHERE column2 LIKE | NOT LIKE pattern;