-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSQL1.sql
More file actions
80 lines (42 loc) · 1.37 KB
/
Copy pathSQL1.sql
File metadata and controls
80 lines (42 loc) · 1.37 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
CREATE TABLE Students (
StudentID INT PRIMARY KEY,
FirstName NVARCHAR(50),
LastName NVARCHAR(50),
BirthDate DATE,
GradeLevel INT
);
INSERT INTO Students (StudentID, FirstName, LastName, BirthDate, GradeLevel)
VALUES
(3, 'Michael', 'Johnson', '2007-03-15', 7),
(4, 'Emily', 'Davis', '2005-07-20', 9),
(5, 'Matthew', 'Williams', '2006-11-12', 8),
(6, 'Olivia', 'Brown', '2008-02-25', 6),
(7, 'Daniel', 'Garcia', '2007-05-30', 7),
(8, 'Sophia', 'Martinez', '2005-12-14', 9),
(9, 'Liam', 'Lopez', '2006-01-08', 8),
(10, 'Emma', 'Wilson', '2008-06-05', 6);
SELECT * FROM Students;
SELECT * FROM Students
WHERE GradeLevel = 8;
SELECT * FROM Students
WHERE GradeLevel >= 8;
SELECT * FROM Students
WHERE BirthDate > '2006-01-01';
SELECT * FROM Students
ORDER BY LastName ASC;
SELECT * FROM Students
ORDER BY GradeLevel, LastName;
SELECT * FROM Students
WHERE GradeLevel = 8
AND BirthDate > '2006-01-01';
SELECT * FROM Students
WHERE GradeLevel = 7 OR GradeLevel = 8;
SELECT FirstName, LastName FROM Students;
SELECT DISTINCT GradeLevel FROM Students;
SELECT FirstName AS 'First Name', LastName AS 'Last Name' FROM Students;
SELECT * FROM Students
WHERE FirstName LIKE 'M%';
SELECT * FROM Students
WHERE LastName LIKE '%son';
SELECT * FROM Students
WHERE BirthDate IS NULL;