Database Intro
Salesmen Sheet
Order_info Sheet
Business_Info sheet
1.Create your own table design based on the Excel data, and include all relationships (joins). Apply referential integrity rules wherever appropriate.
Import the data from Excel to Access to populate tables:
1. Use the Chen technique and illustrate the E-R diagram for the tables you created
Note: It may be necessary to change the data composition due to normalization issues, if you change the composition detail how and why; (you may find it necessary to create additional tables or fields)
2. Create the appropriate SQL or use Access Queries to complete the following:
Produce the following reports:
salesmen(s_num, s_fname, s_lname, c_rate, s_region, state)
order(o_num, b_num, paid, invoice_amt, date)
business(b_num, b_name, b_phn, add_region, owner_fnm, owner_lnm
owner_phn)
address(add_region, street, city, state, zip)
1. Creating these tables:
CREATE TABLE salesmen(
s_num INTEGER PRIMARY KEY,
s_fname VARCHAR,
s_lname VARCHAR,
c_rate FLOAT,
s_region INTEGER,
state VARCHAR
);
CREATE TABLE address(
add_region INTEGER PRIMARY KEY,
street VARCHAR,
city VARCHAR,
state VARCHAR,
zip VARCHAR
);
CREATE TABLE business(
b_num INTEGER PRIMARY KEY,
b_name VARCHAR,
b_phn INTEGER(10),
add_region INTEGER,
owner_fnm VARCHAR,
owner_lnm VARCHAR,
owner_phn INTEGER(10),
FOREIGN KEY add_region REFERENCES
address(add_region)
);
CREATE TABLE order(
o_num INTEGER PRIMARY KEY,
b_num INTEGER NOT NULL,
paid ENUM('Yes', 'No') NOT NULL,
invoice_amt INTEGER NOT NULL,
date DATE,
FOREIGN KEY b_num REFERENCES business(b_num)
);
2. Queries:
-> SELECT o.b_num, b.bname, o.o_num, o.date, s.s_lname,
o.invoice_amt, s.c_rate, s.c_rate*o.invoice_amt as amt
FROM business b, order o, salesmen s, address a
WHERE o.b_num = b.b_num AND b.add_region =
a.add_region AND s.state = a.state ORDER BY s_lname
-> SELECT UNIQUE s.s_num, CONCAT(s.s_fname, s.s_lname) as
s_name, b.b_num, b.b_name, b.owner_nm
FROM business b, order o, salesmen s, address a
WHERE o.b_num = b.b_num AND b.add_region =
a.add_region AND s.state = a.state AND o.paid = 'No'
Database Intro Salesmen Sheet Order_info Sheet Business_Info sheet 1.Create your own table design based on the...
Database Design Problem You have been hired to review the accuracy of the books of Northeast Seasonal Jobs International (NSJI), a job broker. NSJI matches employers whose business is seasonal (like ski resorts) with people looking for part time positions at such places. Employers are located in the Northeast (New England), but recently expanded to include parts of Canada. NSJI maintains all of this information in a flat file spreadsheet (see attached layout of the spreadsheet structure). Required: 1) From...
I am working on multi-table queries for my SQL class using a premade database, which I have included screenshots of. I received assistance and was able to complete a good number of the queries but the bolded ones seem absolutely impossible to do?? How do I write a query for the bolded questions?? I've scoured my textbook and notes and cannot get anything I try to successfully produce results. 1. List all current reservations with the trip ID, customer’s first...
oracle only database: DROP TABLE ORDERITEMS; DROP TABLE Orders; DROP TABLE BOOKAUTHOR; DROP TABLE BOOKS; DROP TABLE PROMOTION; DROP TABLE AUTHOR; DROP TABLE CUSTOMERS; DROP TABLE PUBLISHER; CREATE TABLE Customers ( Customer# NUMBER(4), LastName VARCHAR2(10) NOT NULL, FirstName VARCHAR2(10) NOT NULL, Email VARCHAR(40), Address VARCHAR2(20), City VARCHAR2(12), State VARCHAR2(2), Zip VARCHAR2(5), Referred NUMBER(4), Region CHAR(2), CONSTRAINT customers_customer#_pk PRIMARY KEY(customer#) ); INSERT INTO CUSTOMERS VALUES (1001, 'MORALES', 'BONITA', '[email protected]', 'P.O. BOX 651', 'EASTPOINT', 'FL', '32328', NULL, 'SE'); INSERT INTO CUSTOMERS VALUES...
USE colonial; CREATE TABLE CUSTOMER (CUSTOMER_NUM CHAR(4) PRIMARY KEY, LAST_NAME CHAR(30) NOT NULL, FIRST_NAME CHAR (30), ADDRESS CHAR(35), CITY CHAR(35), STATE CHAR(2), POSTAL_CODE CHAR(5), PHONE CHAR(12) ); CREATE TABLE RESERVATION (RESERVATION_ID CHAR(7) PRIMARY KEY, TRIP_ID DECIMAL(3,0), TRIP_DATE DATE, NUM_PERSONS DECIMAL(3,0), TRIP_PRICE DECIMAL(6,2), OTHER_FEES DECIMAL(6,2), CUSTOMER_NUM CHAR(4) ); CREATE TABLE TRIP (TRIP_ID DECIMAL(3,0) PRIMARY KEY, TRIP_NAME CHAR(75), START_LOCATION CHAR(50), STATE CHAR(2), DISTANCE DECIMAL(4,0), MAX_GRP_SIZE DECIMAL(4,0), TYPE CHAR(20), SEASON CHAR(20) ); CREATE TABLE TRIP_GUIDES (TRIP_ID DECIMAL(3,0), GUIDE_NUM CHAR(4), PRIMARY KEY (TRIP_ID, GUIDE_NUM)...
Partial Question 10 1/2 pts Give the SQL statement to list the trip name and state for each trip that occurs during one of the Fall seasons that is Early Fall, Spring and Late Fall. Sort by State. Use the wildcard for the season. SELECT TripName, State FROM Trip WHERE Season LIKE '%Fall' OR SEA ORDER BY State: Answer 1: LIKE '%Fall' OR SEASON LIKE 'Spring' Answer 2: ORDER BY Partial Question 11 1/2 pts Give the SQL statement to...