Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions SQL Deep Dive/BETWEEN + AND/questions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,17 @@

/*
* Write your query here
*/
*/SELECT firstname, lastname, age, income
FROM customers
where (age BETWEEN 30 and 50)
AND (income < 50000);

-- What is the average income between the ages of 20 and 50? (Including 20 and 50)
/*
* Write your query here
*/
*/SELECT AVG(income)
FROM customers
WHERE (age BETWEEN 20 AND 50);

The average income between the ages 20 and 50 is = 59361.925908612832

10 changes: 7 additions & 3 deletions SQL Deep Dive/IN/questions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
* Table: orders
* Question: How many orders were made by customer 7888, 1082, 12808, 9623
*/

SELECT * FROM orders;
select *
FROM orders
WHERE customerid IN(7888, 1082, 12808, 9623);


/*
Expand All @@ -13,4 +14,7 @@ SELECT * FROM orders;
* Question: How many cities are in the district of Zuid-Holland, Noord-Brabant and Utrecht?
*/

SELECT * FROM city;
SELECT COUNT("name") AS Cities
FROM city
WHERE district IN ('Zuid-Holland', 'Noord-Brabant', 'Utrecht');