Find all users with 'admin' or 'manager' role

Write a SQL query to find all users with the role of 'admin' or 'manager'.

Problem

Given a table of users and their roles, write a SQL query to find all the users who have the role of 'admin' or 'manager'.
Example input:
| id | name  | role  |
|----|-------|-------|
| 1  | John  | admin |
| 2  | Sarah | user  |
| 3  | Mike  | manager|
Example output:
| id | name  |
|----|-------|
| 1  | John  |
| 3  | Mike  |

Solution

This solution is in SQL. Our A.I. can create solutions in multiple languages.
by sarastevens
SELECT id, name
FROM users
WHERE role = 'admin' OR role = 'manager';

/*

The solution above is optimal because it uses the WHERE clause to filter the results.

*/

A.I. Evaluation of the Solution

The solution above is optimal because it uses the WHERE clause to filter the results.

Evaluated at: 2022-11-25 02:16:27