SQL commands Flashcards

1
Q

SELECT

A

Query info from a database

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

AS

A

rename column or table

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

DISTINCT

A

return unique values

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

WHERE

A

filter results based on specified condition

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

LIKE

A

use with WHERE
match closely matching names using wildcard characters

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

BETWEEN

A

use with WHERE
return results within a range.
Numbers: includes 2nd condition
Text: includes first specified character in 2nd condition

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

AND

A

use with WHERE
meets all conditions

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

OR

A

use with WHERE
meets any condition

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

ORDER BY

A

sorts results
ASC: default
DESC: high to low, Z-A

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

LIMIT

A

specifies number of rows to return
always at end of query

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

CASE

A

if-then conditional
CASE
WHEN … THEN …
ELSE …
END

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

CREATE TABLE

A

creates a new table

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

INSERT INTO

A

adds a new row to a table

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

ALTER TABLE

A

edits table column(s)

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

UPDATE

A

edits table row(s)

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

DELETE FROM

A

deletes rows from a table

17
Q

Constraints

A

specifies how column can be used
eg. data types

18
Q

COUNT()

A

count the number of rows

19
Q

SUM()T

A

sum of the values in a column

20
Q

MAX() /
MIN()

A

the largest / smallest value

21
Q

AVG()

A

the average of the values in a column

22
Q

ROUND()

A

round the values in a column

23
Q

GROUP BY

A

used with select to arrange identical data into groups
WHERE
GROUP BY
ORDER BY
LIMIT

24
Q

HAVING

A

use to filter groups
GROUP BY
HAVING
ORDER BY
LIMIT