-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report for https://neetcode.io/problems/sql-sellers-with-no-sales
The problem statement shows the following:
Write a query to find the names of all sellers who did not make any sales in the year 2020.
Now when I wrote my query:
SELECT
seller_name
FROM seller sl
left join orders od on sl.seller_id = od.seller_id and extract('year' from od.sale_date) = 2020
group by seller_name
having count(order_id)=0
It worked on all test cases except case 14 which shows clearly a bug as the input is:
INSERT INTO customer (customer_id, customer_name) VALUES
(1, 'Roy');
INSERT INTO seller (seller_id, seller_name) VALUES
(1, 'Sam'),
(2, 'Sam'),
(3, 'Tim');
INSERT INTO orders (order_id, sale_date, order_cost, customer_id, seller_id) VALUES
(1, '2020-05-05', 100, 1, 1),
(2, '2019-05-05', 200, 1, 3);
Which shows that Tim didn't make any orders in 2020 and my output shows that but the expected output says otherwise.

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels