Skip to content

Commit 850d76f

Browse files
committed
Upload 190
1 parent 4659660 commit 850d76f

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-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-189-green.svg)](#index)
3+
[![Solved](https://img.shields.io/badge/solved-190-green.svg)](#index)
44
<!-- markdownlint-enable MD041 -->
55

66
# SQL Everyday
@@ -223,6 +223,7 @@ Because this project necessitated a framework to enable consistent daily practic
223223
| 187 | [Sales Analysis III](https://leetcode.com/problems/sales-analysis-iii/description/) | [Solution](solutions/187_sales_analysis_iii.md) | LeetCode | Easy | `HAVING` |
224224
| 188 | [The Winner University](https://leetcode.com/problems/the-winner-university/description/) | [Solution](solutions/188_the_winner_university.md) | LeetCode | Easy | |
225225
| 189 | [Unique Orders and Customers Per Month](https://leetcode.com/problems/unique-orders-and-customers-per-month/description/) | [Solution](solutions/189_unique_orders_and_customers_per_month.md) | LeetCode | Easy | |
226+
| 190 | [Warehouse Manager](https://leetcode.com/problems/warehouse-manager/description/) | [Solution](solutions/190_warehouse_manager.md) | LeetCode | Easy | |
226227
<!-- Index End - WARNING: Do not delete or modify this markdown comment. -->
227228
<!--- cSpell:enable --->
228229

solutions/190_warehouse_manager.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# SQL Everyday \#190
2+
3+
## Warehouse Manager
4+
5+
Site: LeetCode\
6+
Difficulty per Site: Easy
7+
8+
## Problem
9+
10+
Write a solution to report the number of cubic feet of **volume** the inventory occupies in each warehouse.
11+
12+
Return the resulting table in **any order**. [[Full Description](https://leetcode.com/problems/warehouse-manager/description/)]
13+
14+
## Submitted Solution
15+
16+
```sql
17+
-- Submitted Solution
18+
SELECT
19+
w.name AS warehouse_name
20+
,SUM(w.units * p.Width * p.Length * p.Height) AS volume
21+
FROM Products AS p
22+
JOIN Warehouse AS w ON p.product_id = w.product_id
23+
GROUP BY warehouse_name
24+
;
25+
```
26+
27+
## Site Solution
28+
29+
```sql
30+
-- LeetCode Solution
31+
SELECT
32+
w.name AS warehouse_name,
33+
sum(w.units * sub.cubic_ft) AS volume
34+
FROM
35+
Warehouse w
36+
LEFT JOIN (
37+
SELECT
38+
p.product_id,
39+
p.width * p.length * p.height AS cubic_ft
40+
FROM Products p
41+
) AS sub
42+
ON w.product_id = sub.product_id
43+
GROUP BY warehouse_name;
44+
```
45+
46+
## Notes
47+
48+
Site solution uses a subquery. But as in the submitted solution, can solved using `JOIN`.
49+
50+
## NB
51+
52+
TBD
53+
54+
Go to [Index](../?tab=readme-ov-file#index)\
55+
Go to [Overview](../?tab=readme-ov-file)

0 commit comments

Comments
 (0)