-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsql-update-delete.sql
More file actions
41 lines (32 loc) · 882 Bytes
/
sql-update-delete.sql
File metadata and controls
41 lines (32 loc) · 882 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
USE university;
SELECT department, COUNT(amount_paid) AS Transact
FROM students
GROUP BY department;
SELECT department, SUM(amount_paid) AS Total_paid
FROM students
GROUP BY department;
SELECT department, admitted_at, SUM(amount_paid) AS Total_amount
FROM students
GROUP BY department, admitted_at;
SELECT admitted_at, SUM(amount_paid) AS amt_paid
FROM students
GROUP BY admitted_at
ORDER BY amt_paid;
SELECT admitted_at, SUM(amount_paid) AS amt_paid
FROM students
WHERE admitted_at > '2014-09-01'
GROUP BY admitted_at
ORDER BY amt_paid;
SELECT department, COUNT(amount_paid) AS count
FROM students
GROUP BY department
HAVING count > 2;
SELECT department, SUM(amount_paid) AS total
FROM students
GROUP BY department
HAVING total > 60000;
SELECT department, SUM(amount_paid) AS total
FROM students
WHERE admitted_at > '2015-09-01'
GROUP BY department
HAVING total > 30000;