-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path07_Codewars.sql
44 lines (12 loc) · 953 Bytes
/
07_Codewars.sql
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
-- 1 you need to create a simple SELECT statement that will return all columns from the people table WHERE their age is over 50 --
SELECT * FROM people WHERE age > 50;
-- 2 you need to create a simple DISTINCT statement, you want to find all the unique ages --
SELECT DISTINCT ages FROM people;
-- 3 write a query that returns all rows in the custid, custname, and custstate columns from the customers table --
SELECT * FROM customers WHERE column = 'custid' and 'custname' and 'custstate';
-- 4 you need to create a simple SUM statement that will sum all the ages --
SELECT sum(ages) FROM people;
-- 5 you need to create a simple MIN / MAX statement that will return the Minimum and Maximum ages out of all the people --
SELECT min(ages) as age_min, max(ages) as age_max FROM people;
-- 6 create a simple SELECT query to display student information of all ACTIVE students --
SELECT * FROM students WHERE IsActive = '1';