You are part of a development team with Ace Software, Inc. who has recently been contracted to
develop various database capabilities for Online Vehicle Sales, Inc. (OVS). ovs is a startup "dotcom"
with about 10 dealership locations in Maryland, Virginia and Washington, D.C. They sell new and used
cars (compacts, midsizes and full-sizes), sport utility vehicles (SUVs) and light trucks. Currently their
business is just based on customers visiting one of the 10 dealershiplocations in person, but soon they
plan to move the bulk of their business the Internet. Initially they have expressed a desire to have a
custom OLTP database, and a custom DSS database, designed and built by your company. Each
dealership has a staff of salespersons who assist customers in the purchase of different types of vehicles
for which various financing plans are available. New and used vehicles are provided to each dealership
based on sales and inventory needs.
AnERD for a 3NF normalized online transaction processing (OLTP) relational database for this
application is provided.
ovc, Inc. Database ERD
Using an SQL script file, create Oracle tables for the CUSTOMER, VEHICLE (i.e. SALE_VEHICLE), and SALE
entities shown in the ERD. Use the plural form of the entity name for your table names (i.e.
CUSTOMERS, VEHICLES, and SALES). Note that you are using the SALE_VEHICLE entity to create a
VEHICLEStable. Ignore the TRADE_ IN VEHICLE entity. You will create tables for some of the other
entities in upcoming assignments.
You must include all necessary integrity constraints including primary keys, foreign keys, CHECK
constraints, UNIQUE constraints, and NOT NULL constraints. It is a good practice, but not required, to
explicitly name your constraints.
You can create your database on Nova or any other Oracle system you wish, but you must use the
Populate the VEHICLES and CUSTOMERS tables with at least 10 (ten) rows each.
Populate your SALES table with at least 10 (ten) rows.
Run SELECT * statements on all three tables after they are populated to showtheir contents. To prevent
excessive wrapping you might consider using the SQL*Plus LINESIZE and COLUMN commands.
Submit the following in either an SQL*Plus SPOOL file or screen snapshots of the output if using SQL
Developer or another GUI.:
1) All of your DROP TABLE, CREATE TABLE, and ALTER TABLE SQL statements as they executed and the
2) All of your INSERT SQL statements as they executed and the Oracle responses.
3) The contents of all tables from SELECT * FROM tablename; statements.
Do NOT submit your SQL script files. Only submit the output specified in Steps #1 though #3 above in a
single SPOOL file or Word file.
You must include a SET ECHO ON SQL* Plus statement in your SQL script file to ensure that allthe SQL
that is executed is displayed in your SPOOL file.
Your submission MUST be in a single text, Word, or PDF file with all steps numbered and in order.
These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.
1. SQL Script:
CREATE TABLE CUSTOMERs
( "CUST_ID" VARCHAR2(20) NOT NULL,
"FIRST_NAME" VARCHAR2(20) NOT NULL,
"LAST_NAME" VARCHAR2(20) NOT NULL,
"STREET" VARCHAR2(20) NOT NULL,
"CITY" VARCHAR2(20) NOT NULL,
"STATE" VARCHAR2(20) NOT NULL,
"ZIP" VARCHAR2(20) NOT NULL,
CONSTRAINT CUSTOMER_PK PRIMARY KEY
CREATE TABLE VEHICLES
VIN VARCHAR2(20) NOT NULL
, TYPE VARCHAR2(30) NOT NULL
, MODEL VARCHAR2(60) NOT NULL
, MAKE VARCHAR2(60) NOT NULL
, WHEREFROM VARCHAR2(30) NOT NULL
, WHOLESALE_COST DECIMAL NOT NULL
, TRADE_ID VARCHAR2(20) NOT NULL
, CONSTRAINT VEHICLES_PK PRIMARY KEY
ALTER TABLE VEHICLES
ADD CONSTRAINT VEHICLES_CHK_COST CHECK
(WHOLESALE_COST >= 0);
ALTER TABLE VEHICLES
ADD CONSTRAINT VEHICLES_UK1 UNIQUE
CREATE TABLE SALES
SALE_ID VARCHAR2(20) NOT NULL
, GROSS_SALE_PRICE DECIMAL DEFAULT 0 NOT NULL
, VIN VARCHAR2(20) NOT NULL
, SALESPERSON_ID VARCHAR2(20) NOT NULL
, CUST_ID VARCHAR2(20) NOT NULL
, MILEAGE NUMBER
, SALE_DATE DATE NOT NULL
, VEHICLE_STATUS VARCHAR2(20)
, CONSTRAINT SALES_PK PRIMARY KEY