Partial index workaround using helper column

SQL Medium 2 views
Back to Questions

Problem Description

You want index only on active rows (status='ACTIVE'). Create a helper column active_flag and index it with customer_id.

Input Format

SQL DDL

Output Format

DDL statement(s)

Sample Test Case

Input:
Orders(status, customer_id)
Output:
Index created

Constraints

Workaround for DBs without partial indexes

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next