Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- - Customers Table CREATE TABLE Customers ( CustomerID INT PRIMARY KEY, FirstName VARCHAR ( 2 5 5 ) , LastName VARCHAR ( 2 5

-- Customers Table
CREATE TABLE Customers (
CustomerID INT PRIMARY KEY,
FirstName VARCHAR(255),
LastName VARCHAR(255),
MailingAddress VARCHAR(255),
PhoneNumber VARCHAR(255),
EmailAddress VARCHAR(255)
);
-- Credit Cards Table
CREATE TABLE CreditCards (
CardNumber VARCHAR(255) PRIMARY KEY,
CustomerID INT,
CardType VARCHAR(255),
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);
-- Cars Table
CREATE TABLE Cars (
VIN VARCHAR(255) PRIMARY KEY,
Make VARCHAR(255),
Model VARCHAR(255),
Year INT,
Color VARCHAR(255),
CustomerID INT,
FOREIGN KEY (CustomerID) REFERENCES Customers(CustomerID)
);
-- Maintenance Visits Table
CREATE TABLE MaintenanceVisits (
VisitID INT PRIMARY KEY,
CarVIN VARCHAR(255),
DateOfVisit DATE,
PromisedReturnDate DATE,
MileageAtDropOff INT,
CoordinatorID INT,
FOREIGN KEY (CarVIN) REFERENCES Cars(VIN),
FOREIGN KEY (CoordinatorID) REFERENCES Employees(EmployeeID)-- Assuming there's an Employees table
);
-- Parts Table
CREATE TABLE Parts (
SKUNumber VARCHAR(255) PRIMARY KEY,
PartName VARCHAR(255),
ShelfLocation VARCHAR(255),
RowNumber INT,
StackNumber INT,
SupplierID INT,
UnitsInStock INT,
MinimumUnits INT,
FOREIGN KEY (SupplierID) REFERENCES Suppliers(SupplierID)-- Assuming there's a Suppliers table
);
-- MaintenancePartsUsed Table
CREATE TABLE MaintenancePartsUsed (
VisitID INT,
PartSKUNumber VARCHAR(255),
UnitsUsed INT,
TechnicianID INT,
FOREIGN KEY (VisitID) REFERENCES MaintenanceVisits(VisitID),
FOREIGN KEY (PartSKUNumber) REFERENCES Parts(SKUNumber),
FOREIGN KEY (TechnicianID) REFERENCES Technicians(TechnicianID)-- Assuming there's a Technicians table
);
-- Assuming tables for Employees, Suppliers, and Technicians exist
-- Technicians table would just have an EmployeeID as a FK to Employees Make and show an ER diagram out of this SQL statement with the rectangles, diamonds, etc. Make the diagram

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

Students also viewed these Databases questions