Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here is the table structure DROP TABLE Order_line_t CASCADE CONSTRAINTS ; DROP TABLE PRODUCT_t CASCADE CONSTRAINTS ; DROP TABLE ORDER_t CASCADE CONSTRAINTS ; DROP TABLE

here is the table structure
DROP TABLE Order_line_t CASCADE CONSTRAINTS ;
DROP TABLE PRODUCT_t CASCADE CONSTRAINTS ;
DROP TABLE ORDER_t CASCADE CONSTRAINTS ;
DROP TABLE CUSTOMER_t CASCADE CONSTRAINTS ;
CREATE TABLE CUSTOMER_t
(Customer_Id number NOT NULL,
Customer_Name VARCHAR(25) ,
Customer_Address VARCHAR(30) ,
Customer_City VARCHAR(20) ,
Customer_State VARCHAR(2) ,
Postal_Code VARCHAR(10) ,
CONSTRAINT CUSTOMER_PK PRIMARY KEY (Customer_Id));
CREATE TABLE ORDER_t
(Order_Id INTEGER NOT NULL,
Customer_Id number ,
Order_Date DATE ,
CONSTRAINT ORDER_PK PRIMARY KEY (Order_Id),
CONSTRAINT ORDER_FK1 FOREIGN KEY (Customer_Id) REFERENCES CUSTOMER_t(Customer_Id));
CREATE TABLE PRODUCT_t
(Product_Id number NOT NULL,
Product_Line_Id number ,
Product_Description VARCHAR(50) ,
Product_Finish VARCHAR(20) ,
Standard_Price Decimal(6,2) ,
CONSTRAINT PRODUCT_PK PRIMARY KEY (Product_Id));
CREATE TABLE Order_line_t
(Order_Id INTEGER NOT NULL,
Product_Id number NOT NULL,
Ordered_Quantity number ,
CONSTRAINT Order_line_PK PRIMARY KEY (Order_Id, Product_Id),
CONSTRAINT Order_line_FK1 FOREIGN KEY (Order_Id) REFERENCES ORDER_t(Order_Id),
CONSTRAINT Order_line_FK2 FOREIGN KEY (Product_Id) REFERENCES PRODUCT_t(Product_Id));
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (1, 'Contemporary Casuals', '1355 S Hines Blvd', 'Gainesville', 'FL', '32601-2871');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (2, 'Value Furniture', '15145 S.W. 17th St.', 'Plano', 'TX', '75094-7743');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (3, 'Home Furnishings', '1900 Allard Ave.', 'Albany', 'NY', '12209-1125');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (4, 'Eastern Furniture', '1925 Beltline Rd.', 'Carteret', 'NJ', '07008-3188');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (5, 'Impressions', '5585 Westcott Ct.', 'Sacramento', 'CA', '94206-4056');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (6, 'Furniture Gallery', '325 Flatiron Dr.', 'Boulder', 'CO', '80514-4432');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (7, 'Period Furniture', '394 Rainbow Dr.', 'Seattle', 'WA', '97954-5589');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (8, 'Calfornia Classics', '816 Peach Rd.', 'Santa Clara', 'CA', '96915-7754');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (9, 'M and H Casual Furniture', '3709 First Street', 'Clearwater', 'FL', '34620-2314');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (10, 'Seminole Interiors', '2400 Rocky Point Dr.', 'Seminole', 'FL', '34646-4423');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (11, 'American Euro Lifestyles', '2424 Missouri Ave N.', 'Prospect Park', 'NJ', '07508-5621');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (12, 'Battle Creek Furniture', '345 Capitol Ave. SW', 'Battle Creek', 'MI', '49015-3401');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (13, 'Heritage Furnishings', '66789 College Ave.', 'Carlisle', 'PA', '17013-8834');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (14, 'Kaneohe Homes', '112 Kiowai St.', 'Kaneohe', 'HI', '96744-2537');
INSERT INTO CUSTOMER_t (Customer_Id, Customer_Name, Customer_Address, Customer_City, Customer_State, Postal_Code)
VALUES (15, 'Mountain Scenes', '4132 Main Street', 'Ogden', 'UT', '84403-4432');
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1001, '21/Oct/04', 1);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1002, '21/Oct/04', 8);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1003, '22/Oct/04', 15);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1004, '22/Oct/04', 5);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1005, '24/Oct/04', 3);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1006, '24/Oct/04', 2);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1007, '27/Oct/04', 11);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1008, '30/Oct/04', 12);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1009, '05/Nov/04', 4);
INSERT INTO ORDER_t (Order_Id, Order_Date, Customer_Id)
VALUES (1010, '05/Nov/04', 1);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (1, 'End Table', 'Cherry', 175);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (2, 'Coffe Table', 'Natural Ash', 200);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (3, 'Computer Desk', 'Natural Ash', 375);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (4, 'Entertainment Center', 'Natural Maple', 650);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (5, 'Writers Desk', 'Cherry', 325);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (6, '8-Drawer Desk', 'White Ash', 750);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (7, 'Dining Table', 'Natural Ash', 800);
INSERT INTO PRODUCT_t (Product_Id, Product_Description, Product_Finish, Standard_Price)
VALUES (8, 'Computer Desk', 'Walnut', 250);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1001, 1, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1001, 2, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1001, 4, 1);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1002, 3, 5);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1003, 3, 3);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1004, 6, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1004, 8, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1005, 4, 3);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1006, 4, 1);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1006, 5, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1006, 7, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1007, 1, 3);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1007, 2, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1008, 3, 3);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1008, 8, 3);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1009, 4, 2);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1009, 7, 3);
INSERT INTO Order_line_t (Order_Id, Product_Id, Ordered_Quantity)
VALUES (1010, 8, 10);
COMMIT;
DESC Order_line_t;
DESC ORDER_t;
DESC PRODUCT_t;
DESC CUSTOMER_t;
need the answer too all plesse
image text in transcribed
image text in transcribed
. Print out the hardcopy of the Order database instance using SQL statement, for example, Select *from table_name; Your output should have the full content of the following four tables. You need to copy paste your SQL statements and their corresponding output to Word file before you print. and Order T Customer_T Product T OrderLine T Print out the hardcopy of the database structure using SQLPlus statement, for example, Desc table name; Your output should have the structure of the following four tables. You need to copy and paste your SQL statements and their corresponding output to Word file before you print. Order T Customer_T Product T OrderLine T 2. Continue working on your Order database on the following queries using SQL statements. Copy and past 1) query question, 2) SQL statement and 3) SQL output to a word file, and print it out. 1. List all the desks in the company that cost between 300 and S500 inclusive. 2 List customer states, cities, names by their state, city and names in ascending order. Retrieve the names of customers who are in Texas and Florida. ist customers who haven't placed any orders s. List states that have more than 2 customers 6. Display the total cost for each order that has been 4. L placed and rename the output columns 7. Retrieve the average, highest, and lowest price of each product finish. 8. Display customer IDs who have made less than 2 orders 9. Display the order IDs and the number of product types placed for each order. 10. Create a view for customer in New York and Florida

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

Step: 3

blur-text-image

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions

Question

Define Administration?

Answered: 1 week ago