Skip to content

Commit a7a9b05

Browse files
Add files via upload
1 parent 5c9039b commit a7a9b05

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
-- Drop SalesDB if it exists and then create it.
2+
DROP DATABASE IF EXISTS SalesDB;
3+
CREATE DATABASE SalesDB;
4+
5+
-- Switch to the SalesDB database.
6+
USE SalesDB;
7+
8+
-- ======================================================
9+
-- Table: Customers
10+
-- ======================================================
11+
CREATE TABLE Customers (
12+
CustomerID INT NOT NULL,
13+
FirstName VARCHAR(50),
14+
LastName VARCHAR(50),
15+
Country VARCHAR(50),
16+
Score INT,
17+
PRIMARY KEY (CustomerID)
18+
);
19+
20+
INSERT INTO Customers (CustomerID, FirstName, LastName, Country, Score) VALUES
21+
(1, 'Jossef', 'Goldberg', 'Germany', 350),
22+
(2, 'Kevin', 'Brown', 'USA', 900),
23+
(3, 'Mary', NULL, 'USA', 750),
24+
(4, 'Mark', 'Schwarz', 'Germany', 500),
25+
(5, 'Anna', 'Adams', 'USA', NULL);
26+
27+
-- ======================================================
28+
-- Table: Employees
29+
-- ======================================================
30+
CREATE TABLE Employees (
31+
EmployeeID INT NOT NULL,
32+
FirstName VARCHAR(50),
33+
LastName VARCHAR(50),
34+
Department VARCHAR(50),
35+
BirthDate DATE,
36+
Gender CHAR(1),
37+
Salary INT,
38+
ManagerID INT,
39+
PRIMARY KEY (EmployeeID)
40+
);
41+
42+
INSERT INTO Employees (EmployeeID, FirstName, LastName, Department, BirthDate, Gender, Salary, ManagerID) VALUES
43+
(1, 'Frank', 'Lee', 'Marketing', '1988-12-05', 'M', 55000, NULL),
44+
(2, 'Kevin', 'Brown', 'Marketing', '1972-11-25', 'M', 65000, 1),
45+
(3, 'Mary', NULL, 'Sales', '1986-01-05', 'F', 75000, 1),
46+
(4, 'Michael', 'Ray', 'Sales', '1977-02-10', 'M', 90000, 2),
47+
(5, 'Carol', 'Baker', 'Sales', '1982-02-11', 'F', 55000, 3);
48+
49+
-- ======================================================
50+
-- Table: Products
51+
-- ======================================================
52+
CREATE TABLE Products (
53+
ProductID INT NOT NULL,
54+
Product VARCHAR(50),
55+
Category VARCHAR(50),
56+
Price INT,
57+
PRIMARY KEY (ProductID)
58+
);
59+
60+
INSERT INTO Products (ProductID, Product, Category, Price) VALUES
61+
(101, 'Bottle', 'Accessories', 10),
62+
(102, 'Tire', 'Accessories', 15),
63+
(103, 'Socks', 'Clothing', 20),
64+
(104, 'Caps', 'Clothing', 25),
65+
(105, 'Gloves', 'Clothing', 30);
66+
67+
-- ======================================================
68+
-- Table: Orders
69+
-- ======================================================
70+
-- (Note: The original script was truncated. Assuming a column definition for ShipAddr)
71+
CREATE TABLE Orders (
72+
OrderID INT NOT NULL,
73+
ProductID INT,
74+
CustomerID INT,
75+
SalesPersonID INT,
76+
OrderDate DATE,
77+
ShipDate DATE,
78+
OrderStatus VARCHAR(50),
79+
ShipAddr VARCHAR(255),
80+
PRIMARY KEY (OrderID)
81+
);

0 commit comments

Comments
 (0)