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
Q

INSERT columns into another table query

A

INSERT INTO table2 SELECT column FROM table1 WHERE condition;

26
Q

UPDATE query

A

UPDATE table SET column1 = value1 WHERE condition;

27
Q

SET description

A

specifies names of 1 or more columns that are to be updated

28
Q

DELETE query

A

DELETE FROM table WHERE condition;

29
Q

COUNT description

A

returns number of rows that match the specified criterion

30
Q

SUM description

A

returns sum of values in specified column

31
Q

AVG description

A

returns average value in the specified column

32
Q

MIN description

A

returns lowest value in specified column

33
Q

MAX description

A

returns highest value in specified column

34
Q

Which SQL aggregate functions can only apply to numeric and non-numeric fields?

A

COUNT, MIN, MAX

35
Q

Which SQL aggregate functions can only apply to numeric fields?

A

SUM and AVG

36
Q

DISTINCT has no effect with ___/___ but may have with ___/___

A

MIN/MAX, SUM/AVG

37
Q

SELECT DISTINCT query

A

SELECT DISTINCT column FROM table;

38
Q

AS query

A

SELECT columnName AS newName FROM table;

39
Q

COUNT query

A

SELECT COUNT (column) FROM table WHERE condition;

40
Q

SUM query

A

SELECT SUM (column) FROM table WHERE condition;

41
Q

AVG query

A

SELECT AVG (column) FROM table WHERE condition;

42
Q

GROUP UP query

A

SELECT column FROM table WHERE condition GROUP BY column;

43
Q

HAVING query

A

SELECT column FROM table WHERE condition HAVING condition;

44
Q

ORDER BY query

A

SELECT * FROM table ORDER BY column;

45
Q

ASC|DESC query

A

SELECT column FROM table ORDER BY column ASC|DESC

46
Q

IS NULL|IS NOT NULL query

A

SELECT column1 FROM table WHERE column2 IS NULL | IS NOT NULL;

47
Q

LIKE|NOT LIKE query

A

SELECT column1 FROM table WHERE column2 LIKE | NOT LIKE pattern;