Question

data files: customer INSERT INTO CUSTOMER_TABLE VALUES ( 1,'Contemporary Furnitures','1355 S. Twilight Blvd.','Gainesville','FL','32601-2871' ); INSERT INTO...

data files:
customer
INSERT INTO CUSTOMER_TABLE VALUES (
1,'Contemporary Furnitures','1355 S. Twilight Blvd.','Gainesville','FL','32601-2871'
);
INSERT INTO CUSTOMER_TABLE VALUES (
2,'Budget Furnitures','15145 S.W. 20th St.','Plano','TX','75094-7743'
);
INSERT INTO CUSTOMER_TABLE VALUES (
3,'Home Furnishings','1900 Dillard Ave.','Albany','NY','12209-1125'
);
INSERT INTO CUSTOMER_TABLE VALUES (
4,'Western Furnitures','1925 Beltline Rd.','Carteret','TX','07008-3188'
);
INSERT INTO CUSTOMER_TABLE VALUES (
5,'Impressionable Furnitures','5585 Westcott Ct.','San Jose','CA','94206-4056'
);
INSERT INTO CUSTOMER_TABLE VALUES (
6,'Furniture Galleria','325 Flatiron Dr.','Boulder','CO','80514-4432'
);
INSERT INTO CUSTOMER_TABLE VALUES (
7,'Perigold Furnitures','394 Arrow Dr.','Seattle','WA','97954-5589'
);
INSERT INTO CUSTOMER_TABLE VALUES (
8,'California Classics','816 Beach Rd.','Santa Ana','CA','96915-7754'
);
INSERT INTO CUSTOMER_TABLE VALUES (
9,'Casual Furnitures','3709 First St.','Clearwater','CA','34620-2314'
);
INSERT INTO CUSTOMER_TABLE VALUES (
10,'Seminole Interiors','2400 Rocky Rd.','Seminole','FL','34646-4423'
);
INSERT INTO CUSTOMER_TABLE VALUES (
11,'American Lifestyles','2434 Missouri Ave. N','Prospect Park','NJ','07508-5621'
);
INSERT INTO CUSTOMER_TABLE VALUES (
12,'Battle Creek Home Store','345 Capitol Ave. SW','Battle Creek','MI','49015-3401'
);
INSERT INTO CUSTOMER_TABLE VALUES (
13,'Heritage Furnitures','66789 College Rd.','Carlisle','PA','17013-8834'
);
INSERT INTO CUSTOMER_TABLE VALUES (
14,'Modern Homes','112 Kiowai St.','Waikiki','HI','96744-2537'
);
INSERT INTO CUSTOMER_TABLE VALUES (
15,'Mountain Views','5132 Main Street','Ogden','UT','84403-4432'
);

product
INSERT INTO PRODUCT_TABLE VALUES (
1,'Sofa Bed','Mahogany',174.99,4
);
INSERT INTO PRODUCT_TABLE VALUES (
2,'Coffee Table','Natural Ash',200.99,2
);
INSERT INTO PRODUCT_TABLE VALUES (
3,'Computer Desk','Natural Ash',374.99,2
);
INSERT INTO PRODUCT_TABLE VALUES (
4,'Entertainment Center','Natural Maple',650.00,3
);
INSERT INTO PRODUCT_TABLE VALUES (
5,'Writers Desk','Taupe',324.98,1
);
INSERT INTO PRODUCT_TABLE VALUES (
6,'TV Stand','Dark Wood',750.00,2
);
INSERT INTO PRODUCT_TABLE VALUES (
7,'Dining Table','Natural Ash',800.00,2
);
INSERT INTO PRODUCT_TABLE VALUES (
8,'Computer Desk','Walnut',251.25,3
);
INSERT INTO PRODUCT_TABLE VALUES (
9,'Patio Table','Walnut',151.25,3
);
INSERT INTO PRODUCT_TABLE VALUES (
10,'Side Table','Walnut',151.25,3
);
INSERT INTO PRODUCT_TABLE VALUES (
11,'End Table','Chestnut',200.25,3
);

orderline
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11010,1,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11010,2,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11010,4,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11020,3,8
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11030,3,3
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11040,6,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11040,8,8
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11050,4,5
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11060,4,3
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11060,5,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11060,7,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11070,1,3
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11070,2,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11080,3,3
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11080,8,3
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11090,4,2
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11090,7,3
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11100,8,10
);
INSERT INTO ORDERLINE_TABLE
(OrderID, ProductID, OrderQuantity)
VALUES (
11110,8,20
);

OrderTable
INSERT INTO ORDER_TABLE VALUES (
11010,'10/11/2013',6
);
INSERT INTO ORDER_TABLE VALUES (
11020,'10/21/2013',8
);
INSERT INTO ORDER_TABLE VALUES (
11030,'10/12/2013',15
);
INSERT INTO ORDER_TABLE VALUES (
11040,'10/19/2016',5
);
INSERT INTO ORDER_TABLE VALUES (
11050,'10/14/2017',3
);
INSERT INTO ORDER_TABLE VALUES (
11060,'10/24/2014',2
);
INSERT INTO ORDER_TABLE VALUES (
11070,'10/27/2015',11
);
INSERT INTO ORDER_TABLE VALUES (
11080,'10/30/2018',12
);
INSERT INTO ORDER_TABLE VALUES (
11090,'11/6/2016',4
);
INSERT INTO ORDER_TABLE VALUES (
11100,'11/5/2016',5
);

INSERT INTO ORDER_TABLE VALUES (
11110,'11/5/2017',7
);

1. Add a new field named “Secondary Phone” in CUSTOMER table.
2. Provide a list of the product name, product ID, and unit price for all of the products in the Product table, sorted in alphabetical order by product name. (5pts)m
3. What is the full address of the customer named Modern Homes? That includes the name, street, city, state, and zip code.
4. What is the standard price and standard price if increased by 16% for every product? You will need to include identifying information, such as the ProductID and product description too. Be sure that your column headings are informative.
5. What is the average standard price for the products with a product finish of Natural Ash?
6. Provide a listing of all of the products that includes the difference between its standard price and the overall average standard price of all products. Be sure to include product identifying information, the standard price, the average standard price, and the difference. Be sure the column headings are informative.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here we have the answer for above queries:

1.Ans:To add new column in table use alter command.

Alter table CUSTOMER_TABLE ADD SecondaryPhone number(20);

2.Ans:Use orderby for sorting purpose.

Select productname,productID,unitprice from PRODUCT_TABLE

order by productname;

3.Ans:To find Full address for Modern Homes we have to use where clause

Select customername,street,city,state,zipcode from CUSTOMER_TABLE where customername="Modern Homes";

4.Ans:To Find 16% increment in standard price we can perform algebric operation directly on column.

select productid,productname,standardprice,standardprice*1.16 As "standardprice_Incre" from PRODUCT_TABLE;

5.Ans: To calculate the average we have to use group function as AVG on standardprice.

select AVG(standardprice) from PRODUCT_TABLE where productfinish="Natural Ash";

6.Ans: We have to use alias for table here

select(t.standardprice - a.priceavg) AS "Difference"

from  PRODUCT_TABLE t CROSS JOIN

(select AVG (standardprice)) As "priceavg"

from PRODUCT_TABLE)a;

 
Add a comment
Know the answer?
Add Answer to:
data files: customer INSERT INTO CUSTOMER_TABLE VALUES ( 1,'Contemporary Furnitures','1355 S. Twilight Blvd.','Gainesville','FL','32601-2871' ); INSERT INTO...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need SQL query OrderlD, OrderDate, CustomerlD 1001 21/Oct/10,1 1002, 21/Oct/10,8 1003, '22/Oct/...

    Which orders have been placed since October 20, 2010? I need SQL query OrderlD, OrderDate, CustomerlD 1001 21/Oct/10,1 1002, 21/Oct/10,8 1003, '22/Oct/10, 15 1004, '22/Oct/10, 5 1005, 24/Oct/10, 3 1006, '24/Oct/10, 2 1007, '27/Oct/10,11 1008, 30/Oct/10, 12 1009, '05/Nov/10,4 1010, '0S/Nov/10 1 End Table, Cherry,175, 1 2 Coffee Table, Natural Ash: 200,2 3 Computer Desk, Natural Ash 3752 Natural Ash. 375 Entertainment Center Natural Maple,650, 3 Desk, 'white 6, '8-Drawer Ash, 750,2 7. Dining Tabla Natural Ash,800, 2 'Computer Desk,...

  • Guidelines: The final project (Project 3) is an individual project. It requires writing an individual report...

    Guidelines: The final project (Project 3) is an individual project. It requires writing an individual report and a presentation. Your manager at the VPF wants your help to answer the following questions and form your reply as a complete report. The report should be between 5 and 7 single spaced pages in addition to the cover page, table of contents, statement of Academic Honesty, reference page, and any other diagrams or appendices that will enhance your report. Note: Use the...

  • -- drop tables DROP TABLE REQUEST CASCADE CONSTRAINTS; DROP TABLE FULLORDER CASCADE CONSTRAINTS; DROP TABLE PRODUCT...

    -- drop tables DROP TABLE REQUEST CASCADE CONSTRAINTS; DROP TABLE FULLORDER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; -- create and link tables CREATE TABLE CUSTOMER (    CustomerID   INTEGER,    Name       VARCHAR2(40),    City       VARCHAR2(20),    State       CHAR(2),    Zip       CHAR(5),    CONSTRAINT PK_CUSTOMER        PRIMARY KEY (CustomerID) ); CREATE TABLE PRODUCT (    ProductID   INTEGER,    Description   VARCHAR2(30),    Material   VARCHAR2(20),    Price       NUMBER(5,2),    CONSTRAINT PK_PRODUCT...

  • -- drop tables DROP TABLE REQUEST CASCADE CONSTRAINTS; DROP TABLE FULLORDER CASCADE CONSTRAINTS; DROP TABLE PRODUCT...

    -- drop tables DROP TABLE REQUEST CASCADE CONSTRAINTS; DROP TABLE FULLORDER CASCADE CONSTRAINTS; DROP TABLE PRODUCT CASCADE CONSTRAINTS; DROP TABLE CUSTOMER CASCADE CONSTRAINTS; -- create and link tables CREATE TABLE CUSTOMER (    CustomerID   INTEGER,    Name       VARCHAR2(40),    City       VARCHAR2(20),    State       CHAR(2),    Zip       CHAR(5),    CONSTRAINT PK_CUSTOMER        PRIMARY KEY (CustomerID) ); CREATE TABLE PRODUCT (    ProductID   INTEGER,    Description   VARCHAR2(30),    Material   VARCHAR2(20),    Price       NUMBER(5,2),    CONSTRAINT PK_PRODUCT...

  • 9 We want to find out the courses that each student is not enrolled in. Give a listing of the course descriptions, and the students (lname) who are not taking that specific course (Use a cartesi...

    9 We want to find out the courses that each student is not enrolled in. Give a listing of the course descriptions, and the students (lname) who are not taking that specific course (Use a cartesian product and union it with a minus) drop table student_class; drop table student; drop table class; create table student ( ssn char(11) not null, lname varchar(40) not null, fname varchar(20) not null, phone char(12), address varchar(40), city varchar(20), state char(2), zip char(5), dob date,...

  • Please provide SQL command to provide the product names that customer number C0954327 ordered in January...

    Please provide SQL command to provide the product names that customer number C0954327 ordered in January 2013 here is the database: CREATE DATABASE OrderEntryBMIS325 GO USE OrderEntryBMIS325 GO CREATE TABLE Customer ( CustNo CHAR(8), CustFirstName VARCHAR(20) CONSTRAINT CustFirstNameRequired NOT NULL, CustLastName VARCHAR(30) CONSTRAINT CustLastNameRequired NOT NULL, CustStreet VARCHAR(50), CustCity VARCHAR(30), CustState CHAR(2), CustZip CHAR(10), CustBal Decimal(12,2) DEFAULT 0, CONSTRAINT PKCustomer PRIMARY KEY (CustNo) ) INSERT INTO Customer (CustNo, CustFirstName, CustLastName, CustStreet, CustCity, CustState, CustZip, CustBal) VALUES ( 'C0954327','Sheri','Gordon','336 Hill St.','Littleton','CO','80129-5543',$230.00...

  • I need help for SQL homework. the question: the code for part 1,2: drop table Customer;...

    I need help for SQL homework. the question: the code for part 1,2: drop table Customer; drop table Company; drop table Cruise; drop table TravelAgent; drop table Reservation; drop sequence customerID_seq; drop sequence cruiseID_seq; drop sequence travelAgentID_seq; drop sequence reservationID_seq; create table Customer( customerID number, firstName varchar2(15), lastName varchar2(15), address varchar2(30), phone number(10) not null, age number(3), Constraint Customer_PK Primary Key (customerID), constraint Customer_unique unique (firstName,lastName,phone), constraint Customer_check check(phone is not null) ); create sequence customerID_seq start with 1 increment...

  • DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP...

    DROP TABLE IF EXISTS customers; DROP TABLE IF EXISTS orders; DROP TABLE IF EXISTS order_details; DROP TABLE IF EXISTS items; DROP TABLE IF EXISTS artists; DROP TABLE IF EXISTS employees; -- create tables CREATE TABLE customers (    customer_id INT ,    customer_first_name VARCHAR(20),    customer_last_name VARCHAR(20) NOT NULL,    customer_address VARCHAR(50) NOT NULL,    customer_city VARCHAR(20) NOT NULL,    customer_state CHAR(2) NOT NULL,    customer_zip CHAR(5) NOT NULL,    customer_phone CHAR(10) NOT NULL,    customer_fax CHAR(10),    CONSTRAINT customers_pk...

  • 2. The Vice President of Marketing for your firm wants the firm’s sales representatives to be...

    2. The Vice President of Marketing for your firm wants the firm’s sales representatives to be able to directly view and edit customer details, but only for the state to which a particular sales representative is assigned. You have suggested that this need can be addressed with a view. For example, a view could be created for one particular state, and user account permissions for accessing that view granted only to sales representatives from that state. The VP has asked...

  • Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there a...

    Use only a single SQL statement for each of the following questions 1 Give a listing of all the ssns,first names and the class descriptions of all the classes the students are taking. If there are no class _descriptions display 'No description is available yet'. (USE NVL) 2 Give a listing of only the lname and the class_code for students who are taking 'Introduction to C programming'. (Inner join) 3 Give a lising of all the class_descriptions and the number...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT