shameka h
2010-10-10 17:43:31 UTC
Using the BOOK_CUSTOMER, BOOK_ORDER, ORDERITEMS, and BOOKS tables, create a query using traditional join conditions based on comparisons between primary and foreign keys that will list the customer number, first and last name, and book title. Limit your listing to only those books in the ‘FITNESS’ category.
Here are the tables:
Create table Book_customer
(Customer# NUMBER(4) CONSTRAINT PK_BOOK_CUSTOMER_CUSTOMER# PRIMARY KEY,
LastName VARCHAR2(10),
FirstName VARCHAR2(10),
Address VARCHAR2(20),
City VARCHAR2(12),
State VARCHAR2(2),
Zip VARCHAR2(5),
Referred NUMBER(4));
Create Table Book_order
(Order# NUMBER(4) CONSTRAINT PF_BOOK_ORDER_ORDER# PRIMARY KEY,
Customer# NUMBER(4),
OrderDate DATE,
ShipDate DATE,
ShipStreet VARCHAR2(18),
ShipCity VARCHAR2(15),
ShipState VARCHAR2(2),
ShipZip VARCHAR2(5));
Create Table Publisher
(PubID NUMBER(2) CONSTRAINT PK_PUBLISHER_PUBID PRIMARY KEY,
Name VarCHAR2(23),
Contact VARCHAR2(15),
Phone VARCHAR2(12));
Create Table Author
(AuthorID Varchar2(4) CONSTRAINT PK_AUTHOR_AUTHORID PRIMARY KEY,
Lname VARCHAR2(10),
Fname VARCHAR2(10));
Create table Books
(ISBN VARCHAR2(10) CONSTRAINT PK_BOOKS_ISBN PRIMARY KEY,
Title VARCHAR2(30),
PubDate DATE,
PubID NUMBER (2),
Cost NUMBER (5,2),
Retail NUMBER (5,2),
Category VARCHAR2(12));
CREATE TABLE ORDERITEMS
(ORDER# NUMBER(4) NOT NULL,
ITEM# NUMBER(2) NOT NULL,
ISBN VARCHAR2(10),
QUANTITY NUMBER(3),
constraint pk_orderitems PRIMARY KEY (order#, item#));