SQL practice: Indexes and EXPLAIN

Chapter 31 · 6 questions · included in full access

  1. Question 1 · easy

    Add an index on order_items.order_id.

    Solve it in your browser
  2. Question 2 · easy

    Add an index on orders.customer_id.

    Solve it in your browser
  3. Question 3 · medium

    Run EXPLAIN on a query filtering order_items by order_id. Which scan does it use?

    Solve it in your browser
  4. Question 4 · medium

    Which three columns in this database would you index first, and why?

    Solve it in your browser
  5. Question 5 · hard

    Explain why adding ten indexes to order_items would be a bad idea.

    Solve it in your browser
  6. Question 6 · hard

    Would an index help a query with no WHERE and no JOIN, like SELECT * FROM products? Why or why not?

    Solve it in your browser

These questions are part of full access.

The first chapters of every track are free. Full access is a one-time payment.

See pricing