Skip to content

Solution#168

Open
dimonalek wants to merge 3 commits into
mate-academy:mainfrom
dimonalek:main
Open

Solution#168
dimonalek wants to merge 3 commits into
mate-academy:mainfrom
dimonalek:main

Conversation

@dimonalek
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown

@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.

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 have USE TestDB;; the task requires operating on a database named ShopDB, so you should add CREATE DATABASE ShopDB; (optionally with IF NOT EXISTS) and USE ShopDB; and remove or replace the USE TestDB; line.
  • In the Products table, the Description column is defined as TEXT, and Price is DECIMAL(10, 2); the assignment restricts you to INT, DATE, VARCHAR(50), or VARCHAR(100), so change Description to something like VARCHAR(100) and change Price to one of the allowed types (for example, INT if you store cents or VARCHAR(50) if you store a textual price).
  • In the Customers table definition, the columns are named email and address (lowercase), but the requirement is for Email and Address exactly; 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. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql Outdated
@@ -1 +1,28 @@
# Write your SQL code for the database creation here. Good luck!
use TestDB;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread task.sql Outdated
CREATE TABLE Products(
ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(50) NOT NULL,
Description TEXT,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread task.sql Outdated
ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(50) NOT NULL,
Description TEXT,
Price DECIMAL(10, 2) NOT NULL,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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).

Comment thread task.sql Outdated
ID INT PRIMARY KEY AUTO_INCREMENT,
FirstName VARCHAR(50),
LastName VARCHAR(50),
email VARCHAR(50),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread task.sql Outdated
FirstName VARCHAR(50),
LastName VARCHAR(50),
email VARCHAR(50),
address VARCHAR(100)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown

@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.

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. Rate AI review example

  2. Re-request AI review example

  3. Add AI review comments example

Comment thread task.sql Outdated
@@ -1 +1,28 @@
# Write your SQL code for the database creation here. Good luck!
use ShopDB;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread task.sql Outdated
CREATE TABLE Products(
ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(50) NOT NULL,
Description TEXT,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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).

Comment thread task.sql Outdated
ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(50) NOT NULL,
Description TEXT,
Price DECIMAL(10, 2) NOT NULL,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread task.sql Outdated
ID INT PRIMARY KEY AUTO_INCREMENT,
FirstName VARCHAR(50),
LastName VARCHAR(50),
email VARCHAR(50),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Column name email uses lowercase. The requirement expects exact capitalization Email. Rename this column to Email to match the specification.

Comment thread task.sql Outdated
FirstName VARCHAR(50),
LastName VARCHAR(50),
email VARCHAR(50),
address VARCHAR(100)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Column name address uses lowercase. The requirement expects exact capitalization Address. Rename this column to Address to match the specification.

Copy link
Copy Markdown

@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.

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. Rate AI review example

Comment thread task.sql
@@ -1 +1,29 @@
# Write your SQL code for the database creation here. Good luck!
create database ShopDB;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

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