-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlesson1_basic_queries.sql
More file actions
61 lines (47 loc) · 930 Bytes
/
Copy pathlesson1_basic_queries.sql
File metadata and controls
61 lines (47 loc) · 930 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
52
53
54
55
56
57
58
59
60
61
-- Lesson 1: Basic SQL Queries
-- Show every column
SELECT * FROM Students;
-- Show only names
SELECT Name FROM Students;
-- Show Name and Age
SELECT Name, Age
FROM Students;
-- Show CGPA only
SELECT CGPA
FROM Students;
-- Students with CGPA of 3.90
SELECT *
FROM Students
WHERE CGPA = 3.90;
-- Students aged 22
SELECT Name
FROM Students
WHERE Age = 22;
-- Student named Mary
SELECT Name, CGPA
FROM Students
WHERE Name = 'Mary';
-- Students age 21 and above
SELECT *
FROM Students
WHERE Age >= 21;
-- Students with CGPA less than 3.50
SELECT Name, CGPA
FROM Students
WHERE CGPA < 3.50;
-- Students age 21+ with CGPA above 3.50
SELECT Name, Age
FROM Students
WHERE Age >= 21
AND CGPA > 3.50;
-- Quality Control examples
SELECT *
FROM QualityControl;
SELECT Product, pH
FROM QualityControl;
SELECT BatchID
FROM QualityControl
WHERE Analyst = 'Tomide';
SELECT Product, Status
FROM QualityControl
WHERE Status = 'Fail';