Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9e78de5

Browse files
committed
Adding Solutions
1 parent bf5e444 commit 9e78de5

19 files changed

+83
-1
lines changed

‎README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
# Leetcode SQL Questions & Solutions <br/>
22
#### Repository Contains :<br/>
33

4-
(1) 190+ Leetcode SQL Question Solutions<br/>
4+
(1) All (212) Leetcode SQL Question Solutions<br/>
5+
- Easy Questions : 89<br/>
6+
- Medium Questions : 91<br/>
7+
- Hard Questions : 32<br/>
58
(2) PostgreSQL Dump File (leetcodedb.sql)<br/>
69

710
#### Problem statements of all questions including leetcode premium questions :<br/>

‎dump_file/leetcodedb.sql

0 Bytes
Binary file not shown.

‎easy/1809. Ad-Free Sessions (Easy).sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
SELECT DISTINCT session_id
2+
FROM playback_1809 pb
3+
LEFT JOIN ads_1809 ad
4+
ON pb.customer_id = ad.customer_id AND
5+
ad.timestamp BETWEEN start_time AND end_time
6+
WHERE ad_id IS NULL;
7+
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SELECT customer_id
2+
FROM customers_1821
3+
WHERE year = 2021 AND revenue > 0;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
SELECT TO_CHAR(day,'Day, Month DD, YYYY') AS day
2+
FROM days_1853;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT employee_id,
2+
CASE WHEN employee_id%2 <> 0 AND LEFT(name,1)<>'M' THEN salary
3+
ELSE 0
4+
END AS bonus
5+
FROM employees_1873;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT user_id,MAX(time_stamp) AS last_stamp
2+
FROM logins_1890
3+
WHERE EXTRACT(YEAR FROM time_stamp) = 2020
4+
GROUP BY user_id;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT c1.user_id
2+
FROM confirmations_1939 c1
3+
INNER JOIN confirmations_1939 c2 ON c1.user_id = c2.user_id AND c1.time_stamp < c2.time_stamp
4+
WHERE EXTRACT(EPOCH FROM (c2.time_stamp-c1.time_stamp)) <= 24*60*60;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
SELECT COALESCE(e.employee_id,s.employee_id)
2+
FROM employees_1965 e
3+
FULL OUTER JOIN salaries_1965 s ON e.employee_id = s.employee_id
4+
WHERE e.name IS NULL OR s.salary IS NULL;
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
SELECT DISTINCT e1.employee_id
2+
FROM employees_1978 e1
3+
LEFT JOIN employees_1978 e2
4+
ON e1.manager_id = e2.employee_id
5+
WHERE e1.salary < 30000 AND e2.employee_id IS NULL;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /