Solition#197
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because your task.sql script is missing some required indexes implied by the usage scenario and it also fails to select the database before running, which blocks the checks from completing. You correctly created indexes on Customers.Email and Products.Name and named them after their columns, which matches the login and product-search patterns and satisfies the naming requirement. However, the task also expects you to analyze relational and lookup columns: Orders.CustomerID, OrderItems.OrderID, and OrderItems.ProductID are almost certainly used in joins and lookups, so they should each have their own index (named CustomerID, OrderID, and ProductID respectively) to fully meet the indexing requirement [CHECKLIST ITEM #2]. In addition, the CI logs show ERROR 1046 (3D000): No database selected, which means task.sql must start with a USE <database_name>; statement so that all CREATE INDEX commands run against the correct schema.
To fix this, at the top of task.sql add USE your_database_name; (the same name created in create-database.sql), then add CREATE INDEX CustomerID ON Orders(CustomerID);, CREATE INDEX OrderID ON OrderItems(OrderID);, and CREATE INDEX ProductID ON OrderItems(ProductID);. Once these indexes are in place and the database is selected, your script will better reflect the real access patterns (orders per customer, items per order, products in orders) and should pass the task requirements. You’re very close—your existing choices are good; you just need to extend the same reasoning to the relationship columns and ensure the script targets the right database.
✨ 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,2 +1,2 @@ | |||
| # Write your SQL code for the database creation here. Good luck! | |||
| USE ShopDB; | |||
| CREATE INDEX Email ON Customers(Email); | |||
There was a problem hiding this comment.
The index on Customers(Email) is appropriate and correctly named, but the requirements imply you should also consider other frequently-used or join columns (e.g., CustomerID in Orders, OrderID and ProductID in OrderItems).
| # Write your SQL code for the database creation here. Good luck! | ||
| USE ShopDB; | ||
| CREATE INDEX Email ON Customers(Email); | ||
| CREATE INDEX Name ON Products(Name); |
There was a problem hiding this comment.
Similarly, the index on Products(Name) is valid, but the task expects a broader analysis of the schema; consider adding indexes for relationship/lookup columns in Orders and OrderItems as well.
No description provided.