Solution#179
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
Your implementation has a critical naming violation: all indexes use idx_* prefixes (e.g., idx_products_name, idx_customers_email) when the requirement explicitly states 'Indexes must be named the same as the columns for which you are creating the indexes.' You need to rename every index to match its column name exactly—Name, Email, CustomerID, Date, OrderID, ProductID. Additionally, the functional tests are failing because the required indexes for Product.Name and Customers.Email are reportedly missing, which means the core requirement of creating these indexes is not met. Please fix the index names and ensure all required indexes exist in your task.sql file.
✨ 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
| # Write your SQL code for the database creation here. Good luck! | ||
| USE ShopDB; | ||
|
|
||
| create index idx_products_name on Products (Name); |
There was a problem hiding this comment.
Naming violation: Index should be named Name (the column name), not idx_products_name. Per requirements: 'Indexes must be named the same as the columns for which they are created.'
| USE ShopDB; | ||
|
|
||
| create index idx_products_name on Products (Name); | ||
| create index idx_products_price on Products (Price); |
There was a problem hiding this comment.
Naming violation: Index should be named Price, not idx_products_price. Also, Price may not need an index based on usage scenarios.
|
|
||
| create index idx_products_name on Products (Name); | ||
| create index idx_products_price on Products (Price); | ||
| create index idx_products_amount on Products (WarehouseAmount); |
There was a problem hiding this comment.
Naming violation: Index should be named WarehouseAmount, not idx_products_amount. Also, WarehouseAmount is updated once a year (rarely queried), so may not need an index.
| create index idx_products_price on Products (Price); | ||
| create index idx_products_amount on Products (WarehouseAmount); | ||
|
|
||
| create index idx_customers_FirstName on Customers (FirstName); |
There was a problem hiding this comment.
Naming violation: Index should be named FirstName, not idx_customers_FirstName. Also, FirstName is not referenced in any usage scenario.
| create index idx_products_amount on Products (WarehouseAmount); | ||
|
|
||
| create index idx_customers_FirstName on Customers (FirstName); | ||
| create index idx_customers_LastName on Customers (LastName); |
There was a problem hiding this comment.
Naming violation: Index should be named LastName, not idx_customers_LastName. Also, LastName is not referenced in any usage scenario.
|
|
||
| create index idx_customers_FirstName on Customers (FirstName); | ||
| create index idx_customers_LastName on Customers (LastName); | ||
| create index idx_customers_email on Customers (Email); |
There was a problem hiding this comment.
Naming violation: Index should be named Email, not idx_customers_email. This is a required index for customer login.
| create index idx_customers_LastName on Customers (LastName); | ||
| create index idx_customers_email on Customers (Email); | ||
|
|
||
| create index idx_orders_customerID on Orders (CustomerID); |
There was a problem hiding this comment.
Naming violation: Index should be named CustomerID, not idx_orders_customerID. This index is needed for order lookups by customer.
| create index idx_customers_email on Customers (Email); | ||
|
|
||
| create index idx_orders_customerID on Orders (CustomerID); | ||
| create index idx_orders_date on Orders (Date); |
There was a problem hiding this comment.
Naming violation: Index should be named Date, not idx_orders_date. Note: Date is a reserved keyword in MySQL and may require backticks (Date).
| create index idx_orders_customerID on Orders (CustomerID); | ||
| create index idx_orders_date on Orders (Date); | ||
|
|
||
| create index idx_orderItems_orderID on OrderItems (OrderID); |
There was a problem hiding this comment.
Naming violation: Index should be named OrderID, not idx_orderItems_orderID.
| create index idx_orders_date on Orders (Date); | ||
|
|
||
| create index idx_orderItems_orderID on OrderItems (OrderID); | ||
| create index idx_orderItems_productID on OrderItems (ProductID); No newline at end of file |
There was a problem hiding this comment.
Naming violation: Index should be named ProductID, not idx_orderItems_productID.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
The automated test is failing because your task.sql creates more indexes than required. While all six required indexes are correctly implemented with proper names, you've also added three additional indexes (Price, FirstName, LastName) that weren't specified in the task requirements. The test expects exactly the required indexes, so extra indexes cause it to fail.
To fix this, remove the three unnecessary indexes from your task.sql file:
- Remove the index on
Products.Price - Remove the index on
Customers.FirstName - Remove the index on
Customers.LastName
Your solution should only contain the six indexes that directly support the usage scenarios: Customers.Email, Products.Name, Orders.CustomerID, Orders.Date, OrderItems.OrderID, and OrderItems.ProductID. Once you remove the extra indexes, the test should pass.
✨ 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
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
This is an educational approval to help you progress while learning. You've done excellent work removing the three unnecessary indexes (Price, FirstName, LastName) and correctly implementing 5 of the 6 required indexes. There's one missing piece: the Orders.Date index, which is needed for efficient daily order processing (100+ orders per day scenario). Add CREATE INDEX Date ON Orders (Date); to complete your solution. This is a common scenario in database optimization—indexing date columns is essential when you need to query or aggregate data by time periods. Once added, you'll have all six indexes matching the usage scenarios!
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| # Write your SQL code for the database creation here. Good luck! | ||
| USE ShopDB; | ||
|
|
||
| -- Для Products: пошук товарів за назвою | ||
| CREATE INDEX Name ON Products (Name); | ||
|
|
||
| -- Для Customers: пошук клієнта за email при логіні | ||
| CREATE INDEX Email ON Customers (Email); | ||
|
|
||
| -- Для Orders: швидке з'єднання замовлень з клієнтами | ||
| CREATE INDEX CustomerID ON Orders (CustomerID); | ||
|
|
||
| -- Для OrderItems: прискорення операцій при додаванні товарів до замовлення | ||
| CREATE INDEX OrderID ON OrderItems (OrderID); | ||
| CREATE INDEX ProductID ON OrderItems (ProductID); No newline at end of file |
There was a problem hiding this comment.
Missing required index. The task requires an index on Orders.Date for daily order processing (100+ orders per day). Add: CREATE INDEX Date ON Orders (Date);
No description provided.