Skip to content

Commit 0f7f3ff

Browse files
committed
Upload 187
1 parent 667a248 commit 0f7f3ff

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!-- markdownlint-disable MD041 -->
22
[![eevveerryyddaayy release](https://img.shields.io/badge/eevveerryyddaayy-v1.3.0-blue.svg)](https://github.com/ggeerraarrdd/eevveerryyddaayy/)
3-
[![Solved](https://img.shields.io/badge/solved-186-green.svg)](#index)
3+
[![Solved](https://img.shields.io/badge/solved-187-green.svg)](#index)
44
<!-- markdownlint-enable MD041 -->
55

66
# SQL Everyday
@@ -220,6 +220,7 @@ Because this project necessitated a framework to enable consistent daily practic
220220
| 184 | [Project Employees II](https://leetcode.com/problems/project-employees-ii/description/) | [Solution](solutions/184_project_employees_ii.md) | LeetCode | Easy | Window function w/ `GROUP BY` |
221221
| 185 | [Sales Analysis I](https://leetcode.com/problems/sales-analysis-i/description/) | [Solution](solutions/185_sales_analysis_i.md) | LeetCode | Easy | |
222222
| 186 | [Sales Analysis II](https://leetcode.com/problems/sales-analysis-ii/description/) | [Solution](solutions/186_sales_analysis_ii.md) | LeetCode | Easy | `STRING_AGG` vs `GROUP_CONCAT` |
223+
| 187 | [Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii/description/) | [Solution](solutions/187_sales_analysis_iii.md) | LeetCode | Easy | `HAVING` |
223224
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
224225
<!--- cSpell:enable --->
225226

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# SQL Everyday \#187
2+
3+
## Sales Analysis III
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Write a solution to report the **products** that were **only** sold in the first quarter of `2019`. That is, between `2019-01-01` and `2019-03-31` inclusive.
11+
12+
Return the resulting table in **any order**. [[Full Description](https://leetcode.com/problems/sales-analysis-iii/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
p.product_id
20+
,p.product_name
21+
FROM Sales AS s
22+
JOIN Product AS p ON p.product_id = s.product_id
23+
GROUP BY p.product_id, p.product_name
24+
HAVING MIN(sale_date) >= '2019-01-01' AND MAX(sale_date) <= '2019-03-31';
25+
;
26+
```
27+
28+
## Site Solution
29+
30+
```sql
31+
-- LeetCode Solution
32+
-- Site solution essentially the same
33+
```
34+
35+
## Notes
36+
37+
TBD
38+
39+
## NB
40+
41+
`HAVING`
42+
43+
Go to [Index](../?tab=readme-ov-file#index)\
44+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)