Skip to content

feat: add indexes for Customers.Email and Products.Name#198

Open
DRDR92 wants to merge 2 commits into
mate-academy:mainfrom
DRDR92:main
Open

feat: add indexes for Customers.Email and Products.Name#198
DRDR92 wants to merge 2 commits into
mate-academy:mainfrom
DRDR92:main

Conversation

@DRDR92

@DRDR92 DRDR92 commented Jul 15, 2026

Copy link
Copy Markdown

No description provided.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

I am requesting changes because the current solution does not fully implement the required indexing based on the described usage scenario, which is a core part of the task. You correctly added indexes on Customers.Email and Products.Name, which matches the login and product search patterns. However, the task explicitly expects you to analyze frequent order creation and lookups, and Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID are clearly used in joins and lookups; leaving these without indexes means the requirement to index all relevant tables/columns is not met [CHECKLIST ITEM #2].

To fix this, add indexes on those three columns with index names matching the column names, for example:

  • CREATE INDEX CustomerID ON Orders (CustomerID);
  • CREATE INDEX OrderID ON OrderItems (OrderID);
  • CREATE INDEX ProductID ON OrderItems (ProductID);
    Make sure these statements are in task.sql after USE ShopDB; and then run the script against ShopDB to confirm it executes without errors before running test.sql. As a minor improvement (not a blocker), update the file comment at the top of task.sql so it mentions index creation rather than database creation, to better reflect its purpose. Once you add the missing indexes and verify the script runs cleanly, your solution will align well with the task requirements.

✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Important

Fix the issues, commit the changes, and then re-request my review using the Re-request review button2 in the Reviewers tab.

Tip

If you have any comments about this review, please leave a message in the Add a comment section below and mention me with the @mateacademy-ai-mentor tag3.
I will read your message during my next review of your pull request. Please do not reply directly to my comments, as that feature is not supported yet.

Caution

Do not close the pull request until the review is complete. Closing it early can lead to unexpected behavior and disrupt the review process.

Footnotes

  1. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql
USE ShopDB;

CREATE INDEX Email ON Customers (Email);
CREATE INDEX Name ON Products (Name);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The task description requires you to analyze the usage scenario and index all relevant tables/columns. Beyond Email and Name, Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID are likely to be heavily used in joins and lookups and should have indexes created here as well, with names matching the column names.

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Summary

Your solution is approved because it meets all core functional requirements for the task. You correctly set the database context with USE ShopDB; at the top of task.sql, and you created indexes on all the key lookup/join columns: Customers.Email, Products.Name, Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID, with index names matching their respective column names as required. These indexes align with the described usage patterns (login by email, product search by name, and order/order-item lookups by IDs) and should work correctly against the ShopDB MySQL schema.

There are no critical or blocking issues remaining; the script should execute successfully and fulfill the task’s expectations. The only minor improvement to consider is updating the top comment in task.sql so it clearly states that the script creates indexes rather than the database, which will make the file’s purpose more obvious to future readers. Overall, you’ve implemented the indexing logic well and followed the naming and placement conventions accurately—nice work.


✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨

Footnotes

  1. Rate AI review example

Comment thread task.sql
USE ShopDB;
USE ShopDB;

CREATE INDEX Email ON Customers (Email);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script correctly sets the database context and then creates all required indexes with names matching their columns. The only small improvement you might consider is updating the top comment to say this file creates indexes (not the database), so its purpose matches the task description more clearly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants