SQL Sample Questions
SQL Sample Questions
Table : Station: LinkTable : Trip LinkYou can write the query here itself for this. List of station names with more than 10
Write an SQL query to give the details(first_name, last_name, DoB and Mobile number) of all managers working by
number as XXXXX i.e. 8197712345 will become 81977XXXXX.
Follow-up Questions:
- Write a SQL query to give the total sum of incoming and outgoing call duration of all the employees.
- Write an SQL query to give me only those mobile numbers where the total outgoing call duration is greater then th
SQL::
```
| date | cash_flow |
|------------|-----------|
| 2018-01-01 | -1000 |
| 2018-01-02 | -100 |
| 2018-01-03 | 50 |
| ... | ... |
```
**Task: **Write a query to get *cumulative* cash flow for each day such that we end up with a table in the form belo
```
| date | cumulative_cf |
|------------|---------------|
| 2018-01-01 | -1000 |
| 2018-01-02 | -1100 |
| 2018-01-03 | -1050 |
| ... | ... |
```
Follow-up Question:
You have a dataset containing 4 columns which gives insight into entire user log of instagram for a complete day. D
OUT, Customer_ID, Session_ID) 1) How many users were active at 9:00AM on the platform (yesterday)? 2) Max. u
was active from 9:00AM to 10:00AM on the platform (yesterday)?
tarted from the station)."Can you tell me the execution order of this?Follow-up Questions:Do you see any other optimal way to do it?
other optimal way to do it? Do you see any difference in inner join and left join in terms of the execution efficiency? For each region_
efficiency? For each region_id top 3 origination/start stations (by trip count).
Table : Station
id name region_id
352 Goettingen St 3
91 Berry St at Ki 3
148 Horton St at 4 13
105 16th St at Pro 3
172 College Ave at 12
188 Dover St at 57 12
514 Laurel St at Ca 3
395 Kerley Dr at 5
234 Farnam St at F 12
357 2nd St at Julia 5
Table : Trip
trip_id start_station_id start_ts
63,120,150,729,180,700 67 2015-07-29 18:07:00 UTC
38,520,141,029,054,000 73 2014-10-29 05:40:00 UTC
47,920,150,131,113,100 50 2015-01-31 11:31:00 UTC
44,220,141,020,171,300 77 2014-10-20 17:13:00 UTC
48,620,140,225,153,800 77 2014-02-25 15:38:00 UTC
12,492,018,041,718,200 59 2018-04-17 18:24:16 UTC
38,620,160,217,091,600 50 2016-02-17 09:16:00 UTC
34,820,150,410,164,400 65 2015-04-10 16:44:00 UTC
38,020,141,014,070,200 69 2014-10-14 07:02:00 UTC
9,072,017,092,916,040 4 2017-09-29 16:04:27 UTC
38,420,150,810,084,100 55 2015-08-10 08:41:00 UTC
17,920,151,111,231,400 2 2015-11-11 23:14:00 UTC
40,620,150,119,101,100 69 2015-01-19 10:11:00 UTC
37,520,151,028,091,600 69 2015-10-28 09:16:00 UTC
52,520,150,325,122,600 66 2015-03-25 12:26:00 UTC
26,982,017,121,108,100 84 2017-12-11 08:10:26 UTC
34,020,160,705,090,300 55 2016-07-05 09:03:00 UTC
9,252,017,083,119,260 163 2017-08-31 19:26:04 UTC
33,052,017,121,213,400 27 2017-12-12 13:44:51 UTC
33,782,018,022,308,300 22 2018-02-23 08:34:58 UTC
capacity has_kiosk
23 TRUE
23 TRUE
23 FALSE
19 TRUE
15 TRUE
15 FALSE
23 TRUE
27 TRUE
19 FALSE
23 TRUE