Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
Yuriy P committed Feb 5, 2024
1 parent afc2036 commit 4a9f520
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion task.sql
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# Write your SQL code for the database creation here. Good luck!
CREATE DATABASE ShopDB;

USE ShopDB;

CREATE TABLE Products (
ID INT AUTO_INCREMENT PRIMARY KEY,
Name VARCHAR(100),
Description VARCHAR(100),
Price DECIMAL(10 , 2 ),
WarehouseAmount INT
);


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


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


CREATE TABLE OrderItems (
ID INT AUTO_INCREMENT PRIMARY KEY,
OrderID INT,
ProductID INT,
FOREIGN KEY (OrderID)
REFERENCES Orders (ID)
ON DELETE SET NULL,
FOREIGN KEY (ProductID)
REFERENCES Products (ID)
ON DELETE SET NULL
);

0 comments on commit 4a9f520

Please sign in to comment.