1 Flashcards
1
Q
Start of every statemtn
A
SELECT
2
Q
Reference a database table
A
FROM
3
Q
Produce 10 rows
A
LIMIT 10
4
Q
Number of user id (no repeat)
A
COUNT( DISTINCT user_id)
5
Q
equal, not equal, less than/equal, great than/equal
A
= <> != <= =>
6
Q
Condition statement specific date
A
WHERE date = ‘2022-01-25’
7
Q
More condition statements
A
AND
8
Q
Alternative condition statement
A
OR
9
Q
Instead of writing OR device_id = 2 OR device_id = 3 could write
A
Device_id IN (2,3)
10
Q
Return true if value is null
A
IS NULL
11
Q
Return a word with second letter r
A
_r%
12
Q
Aggregate functions
A
SUM, MAX, MIN, AVG
13
Q
Rename column name
A
AS
14
Q
Change type
A
CAST(price AS FLOAT)
15
Q
Make sure returns to 1dp
A
/100.0