#26 Creating Indexes for the products Table

Companies:
Sberbank
Themes:
SQLIndexesPractice

Which indexes are needed for these queries?

CREATE TABLE products {
    id SERIAL NOT NULL,
    name TEXT(255) NOT NULL,
    price FLOAT NOT NULL,
    creation_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    is_active BOOLEAN
}

SELECT *
FROM products
WHERE price > 100
    AND creation_time >= CURRENT_DATE - INTERVAL '1 day';

SELECT *
FROM products
WHERE price > 1000;

SELECT *
FROM products
WHERE creation_time >= CURRENT_DATE - INTERVAL '1 week';

Question review

Mentor
Answer as you would in a real interview. I’ll ask follow-up questions, then compare your answer with the reference answer and show your accuracy as a %.
Sign in to start the dialogue The mentor keeps the context of the current question and your previous messages.
Sign in