Question
There are some problems with the database. for example, offices and employees do not have any connection to other tables. Produce the connections and connect
There are some problems with the database. for example, offices and employees do not have any connection to other tables. Produce the connections and connect all the tables.
CREATE TABLE Offices ( Office_Code INT NOT NULL PRIMARY KEY, City VARCHAR(30) NOT NULL, Phone_No VARCHAR(20) NOT NULL, Address1 VARCHAR(255) NOT NULL, Address2 VARCHAR(255), Post_Code VARCHAR(20) NOT NULL, Territory VARCHAR(30) NOT NULL );
CREATE TABLE Employees ( ID INT NOT NULL PRIMARY KEY, Fname VARCHAR(50) NOT NULL, Lname VARCHAR(50) NOT NULL, Email VARCHAR(100) NOT NULL, Job_Title VARCHAR(50) NOT NULL, Office_Code INT NOT NULL, Extension VARCHAR(10), SupervisorID INT, FOREIGN KEY (Office_Code) REFERENCES Offices (Office_Code) );
CREATE TABLE Customers ( CustomerID INT NOT NULL PRIMARY KEY, Full_Name VARCHAR(50) NOT NULL, Tel_No VARCHAR(40) NOT NULL, Address1 VARCHAR(255) NOT NULL, Address2 VARCHAR(255), City VARCHAR(30) NOT NULL, Country VARCHAR(40) NOT NULL, PostCode VARCHAR(20) NOT NULL, Sales_Amount DECIMAL(16 , 4 ) NOT NULL, Comp_Rep VARCHAR(70) NOT NULL, Credit_Limit_No INT );
CREATE TABLE Orders ( OrderID INT NOT NULL PRIMARY KEY, Placement_Date DATE NOT NULL, Req_Date DATE NOT NULL, Shipped_Date DATE, Order_Status VARCHAR(30) NOT NULL, Comments VARCHAR(255) NOT NULL, CustomerID INT NOT NULL, FOREIGN KEY (CustomerID) REFERENCES Customers (CustomerID) );
CREATE TABLE Product_Line ( LineID INT NOT NULL PRIMARY KEY, Line_Description VARCHAR(255) NOT NULL, Website_URL VARCHAR(255) NOT NULL, Product_Image BLOB );
CREATE TABLE Products ( ProductID INT NOT NULL PRIMARY KEY, Name VARCHAR(50) NOT NULL, Line INT NOT NULL, Weight DECIMAL(6 , 4 ) NOT NULL, Vendor VARCHAR(255) NOT NULL, Description VARCHAR(255) NOT NULL, In_Stock INT NOT NULL, Buying_Price DECIMAL(8 , 4 ) NOT NULL, MSRP DECIMAL(4 , 2 ) NOT NULL, FOREIGN KEY (Line) REFERENCES Product_Line (LineID) );
CREATE TABLE Order_Content ( OrderID INT NOT NULL, ProductID INT NOT NULL, Quantity INT NOT NULL, Price DECIMAL(12 , 4 ) NOT NULL, Order_Que INT NOT NULL, FOREIGN KEY (OrderID) REFERENCES Orders (OrderID), FOREIGN KEY (ProductID) REFERENCES Products (ProductID) );
CREATE TABLE Payments_Recieved ( CustomerID INT NOT NULL, Cheque_No VARCHAR(18) NOT NULL, Payment_Date DATE NOT NULL, Amount_Paid DECIMAL(12 , 6 ) NOT NULL );
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started