Add a computed column for search
SQL
Hard
2 views
Problem Description
Add a column searchable_name in Customers that stores lower(name) for case-insensitive search, then index it.
Output Format
DDL statement(s)
Sample Test Case
Output:
Column and index created
Constraints
If generated columns not supported, update manually
Official Solution
ALTER TABLE Customers ADD COLUMN searchable_name VARCHAR(200); UPDATE Customers SET searchable_name = LOWER(name); CREATE INDEX idx_customers_searchable_name ON Customers(searchable_name);
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!