-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect_class_exercises.sql
More file actions
51 lines (40 loc) · 879 Bytes
/
Copy pathselect_class_exercises.sql
File metadata and controls
51 lines (40 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
USE albums_db;
USE fruits_db;
SELECT id,
name,
quantity
FROM fruits;
SELECT name,
quantity
FROM fruits;
SELECT *
FROM fruits;
SELECT *, quantity >= 3
FROM fruits;
SELECT DISTINCT name, quantity
FROM fruits;
USE employees;
SELECT *
FROM titles;
SELECT DISTINCT title
FROM titles;
SELECT *
FROM titles
WHERE (title = 'senior engineer' OR title = 'staff')
AND from_date BETWEEN '1991-01-01' AND '2000-01-01';
/* this is an inclusive date-listing (ie, it includes the from_dates) */
SELECT title = 'Senior Engineer',
title
FROM titles;
SELECT 2 = 2, 1 = 2;
SELECT 2 + 3;
SELECT title,
title = 'Senior Engineer' AS 'boolean'
-- the 'AS' is an alias namer, and can also make restricted words as titles.
FROM titles;
SELECT *,
title = 'Senior Engineer' AS 'Is_Senior',
title = 'Staff' AS 'Is_Staff'
FROM titles
WHERE emp_no < 10100
AND to_date = '9999-01-01';