Question: With the details below, draw an ERD: CREATE TABLE warehouse ( id serial PRIMARY KEY, name VARCHAR (255) NOT NULL, address

With the details below, draw an ERD:

 

CREATE TABLE warehouse (
   id serial PRIMARY KEY,
   name VARCHAR (255) NOT NULL,
   address VARCHAR (255) NOT NULL,
   capacity INTEGER NOT NULL,
   occupied INTEGER NOT NULL,
   loading_bays INTEGER NOT NULL,
   access_points INTEGER NOT NULL,
   description VARCHAR (255)
);

CREATE TABLE employee (
   id serial PRIMARY KEY,
   first_name VARCHAR (255) NOT NULL,
   last_name VARCHAR (255) NOT NULL,
   contact_phone VARCHAR (255) NOT NULL,
   contact_email VARCHAR (255) NOT NULL,
   start_date DATE NOT NULL,
   termination_date DATE,
   driver_licence_number VARCHAR (255) NOT NULL,
   driver_licence_expiry_date DATE NOT NULL
);

CREATE TABLE vehicle (
   id serial PRIMARY KEY,
   registration_number VARCHAR (255) NOT NULL,
   type VARCHAR (255) NOT NULL,
   seating_capacity INTEGER NOT NULL,
   carrying_capacity INTEGER NOT NULL,
   load_space INTEGER NOT NULL,
   maximum_load_area_height INTEGER NOT NULL,
   maximum_load_area_width INTEGER NOT NULL,
   maximum_load_area_depth INTEGER NOT NULL,
   status VARCHAR (255) NOT NULL
);

CREATE TABLE customer (
   id serial PRIMARY KEY,
   first_name VARCHAR (255) NOT NULL,
   last_name VARCHAR (255) NOT NULL,
   phone VARCHAR (255) NOT NULL,
   email VARCHAR (255) NOT NULL,
   address VARCHAR (255) NOT NULL
);

CREATE TABLE invoice (
   id serial PRIMARY KEY,
   date DATE NOT NULL,
   customer_id INTEGER REFERENCES customer (id),
   payment_status BOOLEAN NOT NULL
);

CREATE TABLE line_item (
   id serial PRIMARY KEY,
   invoice_id INTEGER REFERENCES invoice (id),
   product_id INTEGER REFERENCES product (id),
   product_description VARCHAR (255) NOT NULL,
   sold_price DECIMAL NOT NULL
);

CREATE TABLE product (
   id serial PRIMARY KEY,
   type_code VARCHAR (255) NOT NULL,
   unpacked_dimensions VARCHAR (255) NOT NULL,
   packed_dimensions VARCHAR (255) NOT NULL,
   unpacked_weight DECIMAL NOT NULL,
   packed_weight DECIMAL NOT NULL
);

CREATE TABLE delivery_request (
   id serial PRIMARY KEY,
   request_date DATE NOT NULL,
   requested_delivery_date DATE NOT NULL,
   actual_delivery_date DATE,
   delivery_address VARCHAR (255) NOT NULL,
   contact_name VARCHAR (255) NOT NULL,
   contact_phone_number

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!