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 8789b96

Browse files
committed
이예진: [SQL] Trips and Users_241128
1 parent a773b36 commit 8789b96

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎SQL/12주차/YJ_Trips and Users.sql‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
WITH NOT_BANNED AS(
2+
SELECT users_id
3+
FROM Users
4+
WHERE banned = 'No'
5+
)
6+
SELECT
7+
request_at Day,
8+
ROUND(
9+
SUM(CASE
10+
WHEN status LIKE 'cancelled_by%' THEN 1
11+
ELSE 0
12+
END) / COUNT(id)
13+
,2) 'Cancellation Rate'
14+
FROM Trips t
15+
WHERE t.client_id IN (SELECT users_id FROM NOT_BANNED)
16+
AND t.driver_id IN (SELECT users_id FROM NOT_BANNED)
17+
AND request_at BETWEEN '2013年10月01日' AND '2013年10月03日'
18+
GROUP BY request_at

0 commit comments

Comments
(0)

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