Skip to content
SQLSimplified
BackendQuestion 5 of 52

Composite Indexes

Problem

The HR application frequently runs a query like WHERE last_name = 'Smith' AND department_id = 50. An index on just last_name isn't fast enough. Write a DDL statement to create a composite index named idx_name_dept on employees covering both last_name and department_id.

Database Schema

This problem acts as a scratchpad. You will write your own DDL/DML or conceptual queries, so there is no predefined schema.

Try It

Loading playground environment...

Hint

Solution