CJCoding With Joseph
15free / daySign inCreate account

A View of Active Students

Create a view called active_students that lists only the students whose status is 'active'. The view must have exactly four columns, taken straight from students: id, first_name, last_name and gpa. Leave the SELECT at the bottom of the editor in place: it shows what the view returns, sorted by id.

Expected result:

Table active_students
✓ id INTEGER
✓ first_name TEXT
✓ last_name TEXT
✓ gpa REAL

+----+------------+-----------+------+
| id | first_name | last_name |  gpa |
+----+------------+-----------+------+
|  1 | Ava        | Patel     |  3.8 |
|  2 | Liam       | Nguyen    | 3.45 |
|  3 | Sophia     | Rossi     | 3.92 |
|  4 | Noah       | Kim       | 2.95 |
|  7 | Mia        | Haddad    |  3.8 |
|  8 | Lucas      | Fernandes | NULL |
|  9 | Charlotte  | Dubois    | 3.67 |
| 11 | Amelia     | Schmidt   | 3.05 |
| 12 | Oliver     | Brown     |  2.4 |
| 13 | Harper     | Singh     | 3.55 |
+----+------------+-----------+------+
(showing 10 of 25 rows)
Hints3 available
Topics:
Views & Indexes
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (sel, ins, desc)

Results

Run your SQL to see every statement's output here, then how it compares with the expected answer.

Not sure what is in a table? SHOW TABLES lists them and DESCRIBE students shows the columns — or open the database browser on the left.