easy +10 pts

Select All Users

Retrieve every user from an in-memory SQLite table.

Write a function `select_all_users()` that: 1. Creates an **in-memory** SQLite database using the `sqlite3` module. 2. Creates a table named `users` with columns `id` (INTEGER PRIMARY KEY) and `name` (TEXT NOT NULL). 3. Inserts the following rows (in this order): - (1, 'Alice') - (2, 'Bob') - (3, 'Carol') 4. Executes a query that **selects all rows** from the `users` table. 5. Returns the query results as a **list of lists**, where each inner list is `[id, name]`. The function should not take any arguments and should return exactly `[[1, 'Alice'], [2, 'Bob'], [3, 'Carol']]`.

Constraints

The input data is fixed. The function must use only the `sqlite3` module (standard library). The returned list must maintain insertion order and be a list of lists.

Example

>>> select_all_users()
[[1, 'Alice'], [2, 'Bob'], [3, 'Carol']]
10 points ~15 min

Recent Submissions

No submissions yet — hit Run Tests to try!

Hints

Use `sqlite3.connect(':memory:')` to create an in-memory database.
Create a cursor with `conn.cursor()` and execute DDL and DML statements.
After inserting, commit the transaction and use `cur.fetchall()` to get all rows.
Convert each tuple from `fetchall()` to a list before returning.
Python 3
All tests passed!
Test Results
Press Ctrl+Enter or click Run Tests to execute your code.