Practice Interview Questions
| Question | Status |
|---|---|
Write a SQL query that lists the top 3 cities that have the most completed trade orders. The output should include the city and the number of completed orders for that city. Assume that all cities have a different total order count.
users table:
| Column Name | Description |
|---|---|
| user_id | Unique identifier for each user |
| city | City the user is located |
| Email address of the user | |
| signup_date | Date the user signed up |
trades table:
Write a SQL query that lists the top 3 cities that have the most completed trade orders. The output should include the city and the number of completed orders for that city. Assume that all cities have a different total order count.
users table:
| Column Name | Description |
|---|---|
| user_id | Unique identifier for each user |
| city | City the user is located |
| Email address of the user | |
| signup_date | Date the user signed up |
trades table:
| Description |
|---|
| order_id | Unique identifier for each order |
| user_id | user_id who made the trade |
| price | Price of the trade |
| quantity | Quantity involved |
| status | Status of the trade |
| timestamp | Date the trade was made |
| city | total_orders |
|---|---|
| San Francisco | 32 |
| Boston | 29 |
| Denver | 18 |
| Description |
|---|
| order_id | Unique identifier for each order |
| user_id | user_id who made the trade |
| price | Price of the trade |
| quantity | Quantity involved |
| status | Status of the trade |
| timestamp | Date the trade was made |
| city | total_orders |
|---|---|
| San Francisco | 32 |
| Boston | 29 |
| Denver | 18 |