Skip to content
Sharp

SQL for Java Devs · interview question

Which of the following SQL statements would be most improved by adding an index to the 'product_id' column of an 'orders' table?

Multiple choiceMediumchapter-8-curatedpremiumsql-for-java-devsindexes
Choose one answer
Answer and explanation

Correct answer

C. SELECT * FROM orders WHERE product_id = 123

Why

An index on the 'product_id' column would significantly enhance the performance of SELECT queries that filter based on that column, as it allows the database to quickly locate the relevant rows.

Test yourself on SQL for Java Devs

A free test with instant, explained results. No account needed.

Start free test
All SQL for Java Devs questions →