CJCoding With Joseph
15free / daySign inCreate account

Index the Student Last Names

The student search looks people up by surname, so speed it up: create an index called idx_students_last_name on the single column last_name of the students table. The grader compares the index's columns, not its name, so make sure it covers exactly last_name and nothing else.

Expected result:

Table students
✓ id INTEGER PRIMARY KEY
✓ first_name TEXT NOT NULL
✓ last_name TEXT NOT NULL
✓ email TEXT NOT NULL
✓ major_department_id INTEGER
✓ enrollment_year INTEGER NOT NULL
✓ gpa REAL
✓ city TEXT
✓ birth_date TEXT
✓ status TEXT NOT NULL DEFAULT 'active'
✓ scholarship_amount REAL
✓ major_department_id REFERENCES departments(id)
✓ UNIQUE (email)
✓ INDEX ON (last_name)
Hints2 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.