Solution#168
Conversation
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because a few core requirements are not yet met and they will cause the automated tests and checklist checks to fail.
Critical issues that must be fixed:
- At the top of
task.sql, you currently haveUSE TestDB;; the task requires operating on a database namedShopDB, so you should addCREATE DATABASE ShopDB;(optionally withIF NOT EXISTS) andUSE ShopDB;and remove or replace theUSE TestDB;line. - In the
Productstable, theDescriptioncolumn is defined asTEXT, andPriceisDECIMAL(10, 2); the assignment restricts you toINT,DATE,VARCHAR(50), orVARCHAR(100), so changeDescriptionto something likeVARCHAR(100)and changePriceto one of the allowed types (for example,INTif you store cents orVARCHAR(50)if you store a textual price). - In the
Customerstable definition, the columns are namedemailandaddress(lowercase), but the requirement is forEmailandAddressexactly; rename these columns to match the required capitalization so checks that look for exact names will pass.
Your foreign keys, AUTO_INCREMENT primary keys, and overall table structure look good, so once you adjust the database name, data types, and column names to match the specification, your script should be in great shape for the tests.
✨ 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 +1,28 @@ | |||
| # Write your SQL code for the database creation here. Good luck! | |||
| use TestDB; | |||
There was a problem hiding this comment.
The task requires creating a database called ShopDB and running the script in that schema. This line uses TestDB and doesn't create ShopDB. Add CREATE DATABASE ShopDB; and USE ShopDB; (or at least USE ShopDB;) instead of USE TestDB; so the script acts on the required database.
| CREATE TABLE Products( | ||
| ID INT PRIMARY KEY AUTO_INCREMENT, | ||
| Name VARCHAR(50) NOT NULL, | ||
| Description TEXT, |
There was a problem hiding this comment.
The Description column uses type TEXT, which is not allowed by the requirements. Choose one of the permitted types (INT, DATE, VARCHAR(50), or VARCHAR(100)); VARCHAR(100) is appropriate for a product description per the checklist.
| ID INT PRIMARY KEY AUTO_INCREMENT, | ||
| Name VARCHAR(50) NOT NULL, | ||
| Description TEXT, | ||
| Price DECIMAL(10, 2) NOT NULL, |
There was a problem hiding this comment.
The Price column uses DECIMAL(10, 2), which is not one of the allowed types. Use one of the allowed types (for example, INT if storing price in cents, or VARCHAR(50) if textual) to satisfy the requirement that column types be limited to INT, DATE, VARCHAR(50), or VARCHAR(100).
| ID INT PRIMARY KEY AUTO_INCREMENT, | ||
| FirstName VARCHAR(50), | ||
| LastName VARCHAR(50), | ||
| email VARCHAR(50), |
There was a problem hiding this comment.
The Customers table must have a column named Email (capital E) per the requirements. This line defines email (lowercase) — rename it to Email to match the specification exactly.
| FirstName VARCHAR(50), | ||
| LastName VARCHAR(50), | ||
| email VARCHAR(50), | ||
| address VARCHAR(100) |
There was a problem hiding this comment.
The Customers table must have a column named Address (capital A) per the requirements. This line defines address (lowercase) — rename it to Address to match the specification exactly.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am requesting changes because the current SQL script still misses some core requirements and is causing the automated tests to fail. First, at the very top of task.sql, you call USE ShopDB; but never create that database, which leads to the ERROR 1049 (42000): Unknown database 'ShopDB'; you need to add CREATE DATABASE IF NOT EXISTS ShopDB; immediately before the USE ShopDB; statement so the database exists on a fresh server. Second, in the Products table definition, the Description column is declared as TEXT and Price as DECIMAL(10,2), but the assignment only allows INT, DATE, VARCHAR(50), and VARCHAR(100); please switch Description to an allowed type such as VARCHAR(100) and choose an allowed type for Price (for example INT if you store the price in cents). Third, in the Customers table, the column names email and address must exactly match the required capitalization Email and Address, so update those identifiers accordingly so name-based checks will pass. After making these fixes, re-run task.sql followed by the provided tests to confirm everything runs without errors. Your table structure and foreign keys are otherwise well set up, so with these adjustments you should fully meet the assignment 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 +1,28 @@ | |||
| # Write your SQL code for the database creation here. Good luck! | |||
| use ShopDB; | |||
There was a problem hiding this comment.
The task requires the script to create the database named ShopDB. Add CREATE DATABASE ShopDB; (optionally IF NOT EXISTS) before the USE ShopDB; statement so the schema is created on a fresh server and the rest of the script runs within ShopDB.
| CREATE TABLE Products( | ||
| ID INT PRIMARY KEY AUTO_INCREMENT, | ||
| Name VARCHAR(50) NOT NULL, | ||
| Description TEXT, |
There was a problem hiding this comment.
Description is defined as TEXT, but the assignment restricts column types to INT, DATE, VARCHAR(50), or VARCHAR(100). Change this to an allowed type, for example VARCHAR(100).
| ID INT PRIMARY KEY AUTO_INCREMENT, | ||
| Name VARCHAR(50) NOT NULL, | ||
| Description TEXT, | ||
| Price DECIMAL(10, 2) NOT NULL, |
There was a problem hiding this comment.
Price is currently DECIMAL(10, 2), which is not an allowed type. Use one of the permitted types (for example INT if you store price in cents, or VARCHAR(50)), e.g. Price INT NOT NULL.
| ID INT PRIMARY KEY AUTO_INCREMENT, | ||
| FirstName VARCHAR(50), | ||
| LastName VARCHAR(50), | ||
| email VARCHAR(50), |
There was a problem hiding this comment.
Column name email uses lowercase. The requirement expects exact capitalization Email. Rename this column to Email to match the specification.
| FirstName VARCHAR(50), | ||
| LastName VARCHAR(50), | ||
| email VARCHAR(50), | ||
| address VARCHAR(100) |
There was a problem hiding this comment.
Column name address uses lowercase. The requirement expects exact capitalization Address. Rename this column to Address to match the specification.
mateacademy-ai-mentor
left a comment
There was a problem hiding this comment.
Review Summary
I am approving your solution as an educational override so you can keep progressing while you refine the last details. You did a strong job creating all four required tables (Products, Customers, Orders, OrderItems) in ShopDB with appropriate columns, AUTO_INCREMENT primary keys, and foreign keys that correctly use ON DELETE SET NULL, and you also matched the exact capitalization for Customers.Email and Customers.Address. The main remaining issue is near the top of task.sql (around line 1), where you currently have CREATE DATABASE ShopDB; instead of the required CREATE DATABASE IF NOT EXISTS ShopDB; placed immediately before USE ShopDB; — this is important because the tests expect that exact, idempotent statement [CHECKLIST ITEM #1]. To fix this, replace the existing database creation line with the required statement and ensure it appears directly above USE ShopDB;, then re-run task.sql followed by test.sql to confirm everything passes. As a minor improvement, you could make your foreign key columns explicitly NULL or NOT NULL for readability and keep SQL keyword casing consistent (e.g., CREATE, USE, PRIMARY KEY). Overall, your schema design is solid and very close to perfect; with that small database-creation change, it should fully meet all automated checks.
✨ Please rate this review in the Platform's notification center1. I will be grateful for your feedback! ✨
Footnotes
| @@ -1 +1,29 @@ | |||
| # Write your SQL code for the database creation here. Good luck! | |||
| create database ShopDB; | |||
There was a problem hiding this comment.
Replace this line with the required construction CREATE DATABASE IF NOT EXISTS ShopDB; so the database is created idempotently and appears immediately before USE ShopDB; as required by the task.
No description provided.