Sellers With No Sales — LeetCode 1607 Python Solution
EasyLeetCode PremiumDatabase
- Problem
- #1607
- Reading time
- 3 min
- Source
- leetcode.com
Table schema
SQL
Table: Customer +---------------+---------+ | Column Name | Type | +---------------+---------+ | customer_id | int | | customer_name | varchar | +---------------+---------+ customer_id is the column with unique values for this table. Each row of this table contains the information of each customer in the WebStore.Example
SQL
+---------------+---------+
| Column Name | Type |
+---------------+---------+
| customer_id | int |
| customer_name | varchar |
+---------------+---------+
customer_id is the column with unique values for this table.
Each row of this table contains the information of each customer in the WebStore.Python solution
Python
import duckdb
import pandas as pd
def solution(customer: pd.DataFrame, orders: pd.DataFrame, seller: pd.DataFrame) -> pd.DataFrame:
con = duckdb.connect()
con.register("Customer", customer)
con.register("Orders", orders)
con.register("Seller", seller)
return con.execute("""SELECT seller_name
FROM
Seller
LEFT JOIN Orders USING (seller_id)
GROUP BY seller_id
HAVING IFNULL(SUM(YEAR(sale_date) = 2020), 0) = 0
ORDER BY 1;""").df()Complexity
| Measure | Complexity |
|---|---|
| Time | O(n log n) (typical) |
| Space | O(n) auxiliary |
Related problems
Frequently asked questions
- How hard is LeetCode 1607. Sellers With No Sales?
- LeetCode 1607. Sellers With No Sales is rated Easy on LeetCode.
- What topics does LeetCode 1607. Sellers With No Sales cover?
- LeetCode 1607. Sellers With No Sales is tagged Database on LeetCode.
- Is LeetCode 1607. Sellers With No Sales a premium problem?
- Yes. LeetCode 1607. Sellers With No Sales is a LeetCode Premium problem, so the full statement and test cases require a paid LeetCode subscription.