Skip to content

Commit 9055e74

Browse files
Final Project SQL Study I
progate/exercise1.sql Use comparison operators to get all rows from the purchased_at column that have a date earlier than or equal to 2018-11-01 (Including rows with the date 2018-11-01 itself) progate/exercise2.sql Use the LIKE operator to get rows for which the name column includes pudding progate/exercise3.sql Use the NOT operator to get rows for which the character_name column is not Ken the Ninja progate/exercise4.sql Use IS NULL to get rows for which the price column is NULL. progate/exercise5.sql Use the AND operator to get rows for which both of the following conditions are true: 1. The category column is food and 2. The character_name column is Master Wooly progate/exercise6.sql Use ORDER BY and LIMIT to get the following result: • All rows in descending order by the price column • A maximum of 5 rows
1 parent b1b36b6 commit 9055e74

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

SQL Study I Final Project.sql

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
-- after "FROM purchases" add code to rows with a date of "2018-11-01" or earlier in the "purchased_at" column
2+
3+
SELECT *
4+
FROM purchases
5+
WHERE purchased_at <= "2018-11-01";
6+
7+
8+
-- after "FROM purchases" add code to get rows where the "name" contains "pudding"
9+
10+
SELECT *
11+
FROM purchases
12+
WHERE name LIKE "%pudding%";
13+
14+
/*
15+
after "FROM purchases" use the NOT operator to get rows where
16+
the "character_name" column is not "Ken the Ninja"
17+
*/
18+
19+
SELECT *
20+
FROM purchases
21+
WHERE NOT character_name = "Ken the Ninja";
22+
23+
-- after "FROM purchases" add code to get rows
24+
-- where the "price" column is NULL
25+
26+
SELECT *
27+
FROM purchases
28+
WHERE price IS NULL;
29+
30+
-- after "FROM purchases" add code to get rows where the "category" column is "food"
31+
-- and the "character_name" column is "Master Wooly"
32+
33+
SELECT *
34+
FROM purchases
35+
WHERE category = "food"
36+
AND character_name = "Master Wooly";
37+
38+
-- after "FROM purchases" add code to get a maximum of 5 rows
39+
-- in descending order by the "price" column
40+
41+
SELECT *
42+
FROM purchases
43+
ORDER BY price DESC
44+
LIMIT 5;

0 commit comments

Comments
 (0)