Loading problem...
A lending analytics team is auditing loan portfolios.
The table loans contains:
Task: Return every distinct user_id that has both of the following:
Output must contain one column:
Sort the final result by user_id in ascending order.
Supported submission environments:
loans:
| loan_id | user_id | loan_type |
|---------|---------|------------|
| 683 | 101 | Mortgage |
| 218 | 101 | AutoLoan |
| 593 | 102 | Mortgage |
| 138 | 102 | Refinance |
| 308 | 103 | Refinance |
| 389 | 104 | Mortgage |[
{"user_id":102}
]Only user 102 owns at least one Mortgage and at least one Refinance loan.
loans:
| loan_id | user_id | loan_type |
|---------|---------|-------------|
| 1 | 10 | Mortgage |
| 2 | 10 | Refinance |
| 3 | 10 | Refinance |
| 4 | 11 | Mortgage |
| 5 | 11 | Personal |[
{"user_id":10}
]Duplicate qualifying rows do not change the result. User 11 is missing Refinance.
loans:
| loan_id | user_id | loan_type |
|---------|---------|-------------|
| 20 | 501 | mortgage |
| 21 | 501 | Refinance |
| 22 | 502 | Mortgage |
| 23 | 502 | refinance |[]Matching is case-sensitive. Neither user has both exact labels.
Constraints