Skip to content
Open
Changes from all commits
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
34 changes: 33 additions & 1 deletion task.sql
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
# Write your SQL code for the database creation here. Good luck!
CREATE DATABASE ShopDB;
USE ShopDB;

CREATE TABLE Products (
ID INT PRIMARY KEY AUTO_INCREMENT,
Name VARCHAR(50),
Description VARCHAR(100),
Price INT,
Warehouseamount INT

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 column name should be WarehouseAmount (with capital 'A') to match the requirement specification exactly, not Warehouseamount

);

CREATE TABLE Customers (
ID INT PRIMARY KEY AUTO_INCREMENT,
FirstName VARCHAR(50),
LastName VARCHAR(50),
Email VARCHAR(100),
Address VARCHAR(100)
);

CREATE TABLE Orders (
ID INT PRIMARY KEY AUTO_INCREMENT,
CustomerID INT,
Date DATE,
FOREIGN KEY (CustomerID) REFERENCES Customers(ID) ON DELETE SET NULL
);

CREATE TABLE OrderItems (
ID INT PRIMARY KEY AUTO_INCREMENT,
OrderID INT,
ProductID INT,
FOREIGN KEY (OrderID) REFERENCES Orders(ID) ON DELETE SET NULL,
Foreign KEY (ProductID) REFERENCES Products(ID) ON DELETE SET 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.

Inconsistent casing: Foreign KEY should be FOREIGN KEY for consistency with the rest of the script

);
Loading