Write SQL and Python, run instantly in your browser, and track your progress.
You are a security engineer at Okta, a leading identity and access management provider. As part of a quarterly security audit, you need to generate a report of all high-privilege user accounts (admins and owners) that have Multi-Factor Authentication (MFA) enabled. This report is critical for ensuring that the most powerful accounts are properly secured.
Your task is to query the users table to find all active users who have a role of either 'admin' or 'owner' and have mfa_enabled set to 1.
The final report should include the user's ID, email, role, seat type, organization ID, and the account creation time, sorted with the newest accounts first.
| Column Name | Type |
|---|
You are a security engineer at Okta, a leading identity and access management provider. As part of a quarterly security audit, you need to generate a report of all high-privilege user accounts (admins and owners) that have Multi-Factor Authentication (MFA) enabled. This report is critical for ensuring that the most powerful accounts are properly secured.
Your task is to query the users table to find all active users who have a role of either 'admin' or 'owner' and have mfa_enabled set to 1.
The final report should include the user's ID, email, role, seat type, organization ID, and the account creation time, sorted with the newest accounts first.
| Column Name | Type |
|---|
| user_id | INTEGER |
| org_id | INTEGER |
| TEXT | |
| full_name | TEXT |
| role | TEXT |
| seat_type | TEXT |
| status | TEXT |
| mfa_enabled | INTEGER |
| created_at | TEXT |
| user_id | INTEGER |
| org_id | INTEGER |
| TEXT | |
| full_name | TEXT |
| role | TEXT |
| seat_type | TEXT |
| status | TEXT |
| mfa_enabled | INTEGER |
| created_at | TEXT |
| user_id | org_id | full_name | role | seat_type | status | mfa_enabled | created_at | last_login | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | [email protected] | Feng Ferrari | owner |
| user_id | org_id | full_name | role | seat_type | status | mfa_enabled | created_at | last_login | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | [email protected] | Feng Ferrari | owner |
| user_id | role | seat_type | org_id | created_at | |
|---|---|---|---|---|---|
| 205 | [email protected] | admin | full | 46 | 2025-08-15 |
| 147 | [email protected] | owner | full | 34 | 2025-08-11 |
| 25 | [email protected] |
| user_id | role | seat_type | org_id | created_at | |
|---|---|---|---|---|---|
| 205 | [email protected] | admin | full | 46 | 2025-08-15 |
| 147 | [email protected] | owner | full | 34 | 2025-08-11 |
| 25 | [email protected] |
Showing first 5 of 22 rows. Active admins/owners with MFA enabled.
Showing first 5 of 22 rows. Active admins/owners with MFA enabled.
Your final output should be a result set that meets the following requirements:
1. Filtering:
status of 'active'.mfa_enabled is 1.role is either 'admin' or 'owner'.seat_type (these users don't have full account privileges).2. Columns:
user_idYour final output should be a result set that meets the following requirements:
1. Filtering:
status of 'active'.mfa_enabled is 1.role is either 'admin' or 'owner'.seat_type (these users don't have full account privileges).2. Columns:
user_id| last_login |
| last_login |
| TEXT |
| TEXT |
| full |
| full |
| active |
| active |
| 1 |
| 1 |
| 2025-07-29 |
| 2025-07-29 |
| 2025-08-31 20:18:24 |
| 2025-08-31 20:18:24 |
| 2 | 1 | [email protected] | Tao Schneider | viewer | full | invited | 1 | 2025-08-18 |
| 2 | 1 | [email protected] | Tao Schneider | viewer | full | invited | 1 | 2025-08-18 |
| 3 | 1 | [email protected] | Fang Al-Farsi | member | full | invited | 0 | 2025-07-18 |
| 3 | 1 | [email protected] | Fang Al-Farsi | member | full | invited | 0 | 2025-07-18 |
| 4 | 1 | [email protected] | Ren Nakamura | member | full | deleted | 0 | 2025-06-17 |
| 4 | 1 | [email protected] | Ren Nakamura | member | full | deleted | 0 | 2025-06-17 |
| 5 | 1 | [email protected] | Yan Choi | admin | read_only | active | 1 | 2025-07-02 |
| 5 | 1 | [email protected] | Yan Choi | admin | read_only | active | 1 | 2025-07-02 |
| admin |
| admin |
| full |
| full |
| 6 |
| 6 |
| 2025-08-04 |
| 2025-08-04 |
| 88 | [email protected] | owner | full | 21 | 2025-08-04 |
| 88 | [email protected] | owner | full | 21 | 2025-08-04 |
| 117 | [email protected] | owner | full | 28 | 2025-07-30 |
| 117 | [email protected] | owner | full | 28 | 2025-07-30 |
emailemailroleroleseat_typeseat_typeorg_idorg_idcreated_atcreated_at3. Ordering:
3. Ordering:
created_at in descending order (newest first).user_id in ascending order.created_at in descending order (newest first).user_id in ascending order.