Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions task.sql
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# Write your SQL code for the database creation here. Good luck!
USE ShopDB;
CREATE INDEX Name ON Products (Name);
CREATE INDEX WarehouseAmount ON Products (WarehouseAmount);
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.

According to the usage scenarios, Orders will frequently be queried by customer and by date. You should also create indexes on Orders(CustomerID) and Orders(Date), with index names matching the column names, to fully satisfy the requirement to index all needed tables/columns.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

OrderItems is not indexed here at all, but it will be used heavily via OrderID (to fetch items belonging to an order) and likely ProductID. Consider adding indexes CREATE INDEX OrderID ON OrderItems (OrderID); and CREATE INDEX ProductID ON OrderItems (ProductID); so that all necessary tables from the description are covered.

Loading