Problem
Meta Marketplace wants to identify the user with the second-highest number of completed transactions. Write a SQL query to return that user.
Requirements
- Count only transactions where
status = 'completed'. - Return the user or users tied for the second-highest completed transaction count.
- Include
user_id,user_name, andcompleted_transaction_countin the output. - Order the final result by
user_idascending.
Schema
users
| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Primary key for the user |
| user_name | VARCHAR(100) | Meta Marketplace user name |
| region | VARCHAR(50) | User region |
| signup_date | DATE | Date the user signed up |
transactions
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Primary key for the transaction |
| user_id | INT | User who initiated the transaction |
| amount | DECIMAL(10,2) | Transaction amount |
| status | VARCHAR(20) | Transaction status |
| transaction_date | DATE | Date of the transaction |
Practicing as: Solutions Architect interview at MetaHi, I'll play your Meta interviewer for the Solutions Architect role. Answer the question above like we're in the room, and I'll respond the way a real interviewer would.
You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.

