forked from nabigha-mogharbel/SQL-Exercise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanswers.sh
More file actions
51 lines (44 loc) · 1.01 KB
/
answers.sh
File metadata and controls
51 lines (44 loc) · 1.01 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
SELECT Name FROM students;
SELECT * FROM students WHERE age>30;
SELECT Name FROM students WHERE age>30 AND Gender = 'F';
SELECT points FROM students WHERE Name='Alex';
Insert INTO students
VALUES( '7','AYA', '20', 'F', '100');
UPDATE students
SET Points = '500'
WHERE Name = 'Basma';
UPDATE students
SET Points = '100'
WHERE Name = 'Alex';
CREATE TABLE graduates AS
SELECT ID,Name,Age,Gender,Points
FROM students;
ALTER TABLE graduates
ADD Graduation datetime;
UPDATE graduates
SET Graduation = '08/09/2018'
WHERE Name = 'Layal';
DELETE FROM students
WHERE ID = 4;
SELECT employees.ID ,employees.Name,employees.Company ,companies.Date
FROM employees
INNER JOIN companies on employees.company=companies.Name;
SELECT Name
FROM companies
WHERE Date <2000;
SELECT Name
FROM employees
WHERE Role = 'Graphic Designer';
SELECT max(points)
FROM students;
SELECT avg(points)
FROM students;
SELECT Name
FROM students
WHERE points='500';
SELECT Name
FROM students
WHERE Name like '%s%';
SELECT *
FROM students
ORDER BY Points DESC;