Question: Create the diagram of this sql code. CREATE TABLE Customers ( customer_id INT PRIMARY KEY, name VARCHAR(50) NOT NULL, address VARCHAR(100) NOT NULL, phone VARCHAR(20),

Create the diagram of this sql code. CREATE TABLE Customers ( customer_id INT PRIMARY KEY, name VARCHAR(50) NOT NULL, address VARCHAR(100) NOT NULL, phone VARCHAR(20), email VARCHAR(50) ); CREATE TABLE Packages ( package_id INT PRIMARY KEY, sender_id INT NOT NULL, receiver_id INT NOT NULL, weight DECIMAL(5,2) NOT NULL, value DECIMAL(10,2), current_location INT NOT NULL, FOREIGN KEY (sender_id) REFERENCES Customers (customer_id), FOREIGN KEY (receiver_id) REFERENCES Customers (customer_id), FOREIGN KEY (current_location) REFERENCES Locations (location_id) ); CREATE TABLE Package_History ( package_id INT NOT NULL, location_id INT NOT NULL, date_time DATETIME NOT NULL, PRIMARY KEY (package_id, location_id, date_time), FOREIGN KEY (package_id) REFERENCES Packages (package_id), FOREIGN KEY (location_id) REFERENCES Locations (location_id) ); CREATE TABLE Locations ( location_id INT PRIMARY KEY, location_type VARCHAR(20) NOT NULL, capacity DECIMAL(10,2), -- Truck-specific columns truck_id INT, -- Plane-specific columns plane_id INT, -- Airport-specific columns airport_name VARCHAR(50), airport_location VARCHAR(100), -- Warehouse-specific columns warehouse_location VARCHAR(100) ); CREATE TABLE Trucks ( truck_id INT PRIMARY KEY, location_id INT NOT NULL, capacity DECIMAL(10,2) NOT NULL, FOREIGN KEY (location_id) REFERENCES Locations (location_id) ); CREATE TABLE Planes ( plane_id INT PRIMARY KEY, location_id INT NOT NULL, capacity DECIMAL(10,2) NOT NULL, FOREIGN KEY (location_id) REFERENCES Locations (location_id) ); CREATE TABLE Airports ( location_id INT PRIMARY KEY, airport_name VARCHAR(50) NOT NULL, airport_location VARCHAR(100) NOT NULL, FOREIGN KEY (location_id) REFERENCES Locations (location_id) ); CREATE TABLE Warehouses ( location_id INT PRIMARY KEY, warehouse_location VARCHAR(100) NOT NULL, capacity DECIMAL(10,2) NOT NULL, FOREIGN KEY (location_id) REFERENCES Locations (location_id) );

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!