Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Done! #74

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Done! #74

wants to merge 2 commits into from

Conversation

Uklonsd
Copy link

@Uklonsd Uklonsd commented Feb 11, 2025

No description provided.

Copy link

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

Choose a reason for hiding this comment

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


Thank you for your hard work on this SQL script! 😊 While your solution meets many of the task requirements, there are a few critical issues that need to be addressed before we can approve the pull request:

  1. Foreign Key Constraints: The ON DELETE SET NULL option is used in your foreign key constraints, but the related columns (OrderID and ProductID in OrderItems, and CustomerID in Orders) are not nullable. This will cause errors when trying to set these columns to NULL. Please make these columns nullable to align with the ON DELETE SET NULL behavior.

  2. Data Type for Price: The Price column in the Products table is currently an INT, which may not accommodate fractional values that are common in pricing. Consider changing this to a DECIMAL type to better handle such cases.

Once these issues are resolved, your script will be in great shape! Keep up the great work, and I'm looking forward to your updated submission. 🚀

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

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

task.sql Outdated
ProductID INT AUTO_INCREMENT,
Name VARCHAR(50),
Description VARCHAR(100),
Price INT,

Choose a reason for hiding this comment

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

Consider using a DECIMAL type for the Price column instead of INT to handle fractional prices, which are common in product pricing.

CREATE TABLE Orders (
OrderID INT AUTO_INCREMENT,
CustomerID INT,
FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID) ON DELETE SET NULL,

Choose a reason for hiding this comment

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

The CustomerID column in the Orders table should be nullable if you intend to use ON DELETE SET NULL. Otherwise, this will cause an error when trying to set a non-nullable column to NULL.

OrderItemID INT AUTO_INCREMENT,
ProductID INT,
OrderID INT,
FOREIGN KEY (ProductID) REFERENCES Products (ProductID) ON DELETE SET NULL,

Choose a reason for hiding this comment

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

The ProductID column in the OrderItems table should be nullable if you intend to use ON DELETE SET NULL. Otherwise, this will cause an error when trying to set a non-nullable column to NULL.

ProductID INT,
OrderID INT,
FOREIGN KEY (ProductID) REFERENCES Products (ProductID) ON DELETE SET NULL,
FOREIGN KEY (OrderID) REFERENCES Orders (OrderID) ON DELETE SET NULL,

Choose a reason for hiding this comment

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

The OrderID column in the OrderItems table should be nullable if you intend to use ON DELETE SET NULL. Otherwise, this will cause an error when trying to set a non-nullable column to NULL.

Copy link

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

Choose a reason for hiding this comment

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

Great job on addressing the previous issues! 🎉 The SQL script is now well-structured and meets the task requirements. You've successfully updated the Price column in the Products table to DECIMAL(10,2), which is perfect for handling fractional values. Additionally, making the CustomerID in the Orders table, as well as OrderID and ProductID in the OrderItems table nullable, aligns with the ON DELETE SET NULL behavior in the foreign key constraints.

While the code is approved, remember to review the comments to further enhance your skills. Addressing any critical issues in the future will help you avoid similar problems and improve your coding proficiency. Keep up the great work and continue learning from your experiences! 🚀

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

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