
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Q9) find the least expensive price
Q10) List the UNIQUE v_code of vendors that provide products
Q11) find the most expensive price
Q12) List the number of products by vendor with the average price, include only the rows withaverage price below 10.00
Q13) List all vendor rows (including the ones that have no matching products) and all matchingproduct rows

Transcribed Image Text:DROP TABLE LINE cascade constraints;
DROP TABLE INVOICE cascade constraints;
DROP TABLE CUSTOMER cascade constraints;
DROP TABLE PRODUCT cascade constraints;
DROP TABLE VENDOR cascade constraints;
DROP TABLE EMPLOYEE cascade constraints;
DROP TABLE EMP cascade constraints;
DROP TABLE P cascade constraints;
DROP TABLE V cascade constraints;
purge recyclebin;
CREATE TABLE PRODUCT (
P_CODE VARCHAR2 (10) CONSTRAINT PRODUCT_P_CODE_PK PRIMARY KEY,
P_DESCRIPT
P_INDATE
P_QOH
P_MIN
P_PRICE
P_DISCOUNT
V_CODE
CONSTRAINT PRODUCT_V_CODE_FK
FOREIGN KEY (V_CODE) REFERENCES VENDOR);
VARCHAR2 (35) NOT NULL,
DATE NOT NULL,
NUMBER NOT NULL,
NUMBER NOT NULL,
NUMBER (8,2) NOT NULL,
NUMBER (4,2) NOT NULL,
NUMBER,
CREATE TABLEV (
V_CODE
V_NAME
V_CONTACT
V_AREACODE
V_PHONE
V_STATE
V_ORDER
INTEGER PRIMARY KEY,
VARCHAR ( 35) NOT NULL,
VARCHAR (15) NOT NULL,
CREATE TABLE CUSTOMER (
Cus_CODE
CuS_LNAME
CuS_FNAME
Cus_INITIAL
CUS_AREACODE
CuS_PHONE
Cus_BALANCE
CONSTRAINT CUS_UI1 UNIQUE (CUS_LNAME, CUS_FNAME));
NUMBER PRIMARY KEY,
VARCHAR (15) NOT NULL,
VARCHAR (15) NOT NULL,
CHAR(1),
CHAR (5) DEFAULT '615' NOT NULL CHECK (CUS_AREACODE IN ('615',"713', '931')),
CHAR(8) NOT NULL,
CHAR (5) NOT NULL,
CHAR (8) NOT NULL,
CHAR (2) NOT NULL,
CHAR (1) NOT NULL);
NUMBER (9,2) DEFAULT 0.00,
CREATE TABLE P (
P_CODE
P_DESCRIPT
P_INDATE
P_QOH
P_MIN
VARCHAR2 (10) PRIMARY KEY,
VARCHAR2 (35) NOT NULL,
DATE NOT NULL,
NUMBER NOT NULL,
NUMBER NOT NULL,
NUMBER (8,2) NOT NULL,
NUMBER (4,2) NOT NULL,
NUMBER);
CREATE TABLE INVOICE (
INV_NUMBER
Cus_CODE
INV_DATE
CONSTRAINT INV_CK1 CHECK (INV_DATE > TO_DATE('01-JAN-2819","D0-NON-YYYY")));
NUMBER PRIMARY KEY,
NUMBER NOT NULL REFERENCES CUSTOMER(CUS_CODE),
DATE DEFAULT SYSDATE NOT NULL,
P_PRICE
P_DISCOUNT
V_CODE
CREATE TABLE LINE (
CREATE TABLE VENDOR (
V_CODE
V_NAME
v_CONTACT
V_AREACODE
V_PHONE
V_STATE
v_ORDER
PRIMARY KEY (V_CODE));
NUMBER NOT NULL,
INV_NUMBER
LINE_NUMBER
P_CODE
LINE_UNITS
LINE_PRICE
PRIMARY KEY (INV_NUMBER, LINE_NUMBER),
FOREIGN KEY (INV_NUMBER) REFERENCES INVOICE ON DELETE CASCADE,
FOREIGN KEY (P_CODE) REFERENCES PRODUCT (P_CODE),
CONSTRAINT LINE_UI1 UNIQUE (INV_NUMBER, P_CODE));
INTEGER,
VARCHAR ( 35) NOT NULL,
VARCHAR (15) NOT NULL,
CHAR (5) NOT NULL,
CHAR (8) NOT NULL,
CHAR (2) NOT NULL,
CHAR (1) NOT NULL,
NUMBER (2,0) NOT NULL,
VARCHAR (10) NOT NULL,
NUMBER (9,2) DEFAULT 8.00 NOT NULL,
NUMBER (9,2) DEFAULT 8.00 NOT NULL,

Transcribed Image Text:CREATE TABLE EMPLOYEE (
EMP_NUM
EMP_TITLE
EMP LNAME
EMP_FNAME
EMP_INITIAL
EMP DOB
EMP_HIRE DATE
EMP_YEARS
EMP_AREACODE
EMP_PHONE
/*P rows
NUMBER PRIMARY KEY,
INSERT INTO P VALUES("11QER/31", "Power painter, 15 psi., 3-nozzle
INSERT INTO P VALUES("13-Q2/P2","7.25-in. pwr. saw blade"
INSERT INTO P VALUES("14-Q1/L3", "9.e8-in. pwr. saw blade"
INSERT INTO P VALUES("1546-Q02", "Hrd. cloth, 1/4-in., 2x5e"
INSERT INTO P VALUES("1558-QW1", "Hrd. cloth, 1/2-in., 3x5e
INSERT INTO P VALUES( "2232/QTY", "B\&D jigsaw, 12-in. blade
INSERT INTO P VALUES("2232/QWE", "B\&D jigsaw, 8-in. blade"
INSERT INTO P VALUES("2238/QPD", "B\40 cordless drill, 1/2-in."
INSERT INTO P VALUES("23109-HB", "C1law hamner
INSERT INTO P VALUES("23114-AA", "Sledge hamner, 12 lb."
INSERT INTO P VALUES("54778-21', "Rat-tail file, 1/8-1in. fine'
INSERT INTO P VALUES("89-WRE-Q', "Hicut chain saw, 16 in."
INSERT INTO P VALUES("PVC230RT", "Pc pipe, 3.5-in., 8-ft"
INSERT INTO P VALUES("SM-18277",'1.25-in. netal screw, 25"
INSERT INTO P VALUES("SW-23116","2.5-in. wd. screw, se
INSERT INTO P VALUES("WR3/TT3' ,"Steel ratting, 4''x8" "x1/6", .5" nesh',"17-JAN-2019", 18, 5,119.95,8.10,25595);
e3-NOV-2018', 8, 5,109.99,8.ee,25595);
,'13-DEC-2018", 32, 15, 14.99,8.e5, 21344);
,'13-NOV-2019', 18, 12, 17.49,0.ee,21344);
,'15-JAN-2019', 15, 8, 39.95,0.00,23119);
,'15-JAN-2819", 23, 5, 43.99,8.80, 23119);
,38-DEC-2018', 8, 5,109.92,8.e5,24288);
,"24-DEC-2018', 6, 5, 99.87,8.e5,24288);
,"28-JAN-2019', 12, 5, 38.95,8.e5,25595);
,"20-JAN-2019', 23, 10, 9.95,0.18,21225);
,"e2-JAN-2019', 8, 5, 14.40,0.e5, NULL);
,'15-DEC-2018', 43, 20, 4.99,0.00,21344);
,'87-FEB-2019", 11, 5,256.99,8.05, 24288);
,28-FEB-2019',188, 75, 5.87,0.e0, NULL);
e1-MAR-2019", 172, 75, 6.99,8.e0,21225);
"24-FLB-2019', 237,100, 8.45,0.e0, 21231);
CHAR (10),
VARCHAR (15) NOT NULL,
VARCHAR (15) NOT NULL,
CHAR (1),
DATE,
DATE,
NUMBER,
CHAR (3),
CHAR (8));
CREATE TABLE EMP (
EMP_NUM
EMP_TITLE
EMP LNAME
EMP_FNAME
EMP_INITIAL
EMP_DOB
EMP_HIRE DATE
EMP_AREACODE
EMP_PHONE
EMP_MGR
NUMBER PRIMARY KEY,
CHAR (10),
VARCHAR(15) NOT NULL,
VARCHAR (15) NOT NULL,
CHAR (1),
DATE,
* VENDOR rows
INSERT INTO VENDOR (SELECT • FROM V);
DATE,
CHAR (3),
CHAR (8),
NUMBER);
/* PRODUCT rows
INSERT INTO PRODUCT (SELECT • FRROM P);
* CUSTOMER rOws
INSERT INTO CUSTOMER VALUES (18018, "Ranas
INSERT INTO CUSTOMER VALUES(10011, 'Dunne
INSERT INTO CUSTOMER VALUES(10012, 'Sith
INSERT INTO CUSTOMER VALUES (10013, 'Olowski" , "Paul' ,'F' ,'615', '894-218e",536.75);
INSERT INTO CUSTOMER VALUES (18014, 'Orlando" , 'Hyron ,NULL, '615','222-1672',8);
INSERT INTO CUSTOMER VALUES (18015, '0""Brian", "Any"
INSERT INTO CUSTOMER VALUES (10016, 'Brown"
INSERT INTO CUSTOMER VALUES (18017, 'Willians", "George", NULL, '615", "298-2556",768.93);
INSERT INTO CUSTOMER VALUES (18018, 'Farriss" ,'Anne ,' ,'713",'382-7185', 216.55);
INSERT INTO CUSTOMER VALUES (10019, 'Snith"
/* Loading data rows
/* Turn Escape character on
/* Default escape character "I
/* Used to enter special characters (8)
,'Alfred", 'A" ,'615s', '844-2573",8);
"Leona" ,"K" ,'713','894-1238',8);
"Kathy" , "W ,'615",'894-2285', 345.86);
SET ESCAPE ON;
,'B' ,'713','442-3381',8);
"Janes' ,'6" ,'615','297-1228', 221.19);
/* v rOws
INSERT INTO V VALUES (21225, 'Bryson, Inc."
INSERT INTO V VALUES (21226, 'SuperLoo, Inc."
INSERT INTO V VALUES (21231, 'D\&E Supply"
INSERT INTO V VALUES (21344, 'Jabavu Bros."
INSERT INTO V VALUES (22567, 'Dome Supply'
INSERT INTO V VALUES (23119, 'Randsets Ltd.'
INSERT INTO V VALUES (24804, 'Bracknan Bros."
INSERT INTO V VALUES (24288, 'ORDVA, Inc."
INSERT INTO V VALUES (25443, 'B\&K, Inc."
INSERT INTO V VALUES (25501, 'Damal Supplies"
INSERT INTO V VALUES (25595, 'Rubicon Systens ,'Du Toit'
,"0lette", "K" ,'615', 297-3829",8);
,'Smithson', '615','223-3234', "TN','Y');
"Flushing', '984','215-8995', "FL','N');
615','228-3245', "TN','Y');
'615','889-2546', 'KY', 'N');
981','678-1419', "GA', 'N');
,'Anderson', '981','678-3998", " GA',"Y');
"Browning', '615', 228-1410, TN', 'N');
,"Hakford','615','898-1234',"TN',"Y');
*984','227-0093', 'FL','N');
,"Smythe' ,'615','890-3529","TN', 'N');
984','456-0092", 'FL', 'Y');
/* INVOICE rows
INSERT INTO INVOICE VALUES(1801,18014, '15-JAN-2019');
INSERT INTO INVOICE VALUES(1002, 18811, '16-JAN-2019');
INSERT INTO INVOICE VALUES(1003,10012, '16-JAN-2019');
INSERT INTO INVOICE VALUES(1004, 18e11, '17-JAN-2019');
INSERT INTO INVOICE VALUES(1005,10018, '17-JAN-2819');
INSERT INTO INVOICE VALUES(1006,10014, '17-JAN-2819');
INSERT INTO INVOICE VALUES(1007,18e15, '17-JAN-2019');
INSERT INTO INVOICE VALUES(1808,18011, '17-JAN-2019');
"Singh"
,"Khunalo'
Smith"
Smith
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps

Knowledge Booster
Similar questions
- SQL code for: (1) Hint: A NULL in the hours column should be considered as zero hours. Find the ssn, lname, and the total number of hours worked on projects for every employee whose total is less than 40 hours. Sort the result by lname */ /* (2) For every project that has more than 2 employees working on it: Find the project number, project name, number of employees working on it, and the total number of hours worked by all employees on that project. Sort the results by project number. /* (3) For every employee who has the highest salary in their department: Find the dno, ssn, lname, and salary. Sort the results by department number. */ /* (4) For every employee who does not work on any project that is located in Houston: Find the ssn and lname. Sort the results by lname /* (5) Hint: This is a DIVISION query For every employee who works on every project that is located in Stafford: Find the ssn and lname. Sort the results by lname */arrow_forwardCreate a table named company with these columns: Company_id varchar(255) Company_name varchar(255) default ‘x’ Hq_phone_number varchar(255) Primary key of company_id (please use constraint format) Unique key of Hq_phone_number (please use constraint format)arrow_forward6. Create a list of all book titles and costs. Precede each book’s cost with asterisks so that thewidth of the displayed Cost field is 12. SQL commandsarrow_forward
- Task 14: List the invoice number and invoice date for each invoice that contains an invoice line for a Wild Bird Food (25 lb).arrow_forwardList the names of all Staff members who hold a faculty position and have a salary of $45,000 or less. Show their names as their first name, followed by a space, and then their last name but sort the list alphabetically by last name and then first name. Hint: Check out the Position column in the Staff table. All staff members who do not hold a faculty position will get a bonus this year equal to 5% of their salary. List the names, current salary, and bonus amount for each Staff member (non-faculty) who is due a bonus. Show your list in order with the person receiving the highest bonus first.arrow_forwardSQL Help The Car Maintenance team wants to learn how many times each car is used in every month and day to organize their maintenance schedules. The team wants a table with the following column names and information: Car ID Month Day Count You need to create a summary table using the WITH ROLLUP modifier and grouped by the specific column names, listed above, and send the data back to the team. Query the frequency of each car's use by month and dayarrow_forward
- Database Oracle sql Note :I hope the solution is from HR in the Oracle sql softwarearrow_forward1.What is the result when the following SQL query is executed on a table named products? Choose the most correct answer. SELECT AVG(Products)FROM Products; Group of answer choices The query results in an error because the is no AVG function None of the above The query results in an error be cause a column is not specified The query returns the average of the Products table 2. If the primary key in the Employee table is located in the "ID" column what is the maximum number of results the following SQL SELECT query will return? SELECT *FROM EmployeeWHERE ID = 15; Group of answer choices 2 1 3 Do not have enough information to determine the answer 0arrow_forwardAssume the PRODUCT table contains multiple rows. The following code would include: SELECT P_DESCRIPT, P_PRICE FROM PRODUCT WHERE P_CODE IN(SELECT P_CODE FROM LINE GROUP BY P_CODE HAVING COUNT(*) > 1); Group of answer choices A) Select the products that have been ordered before. B) Select the products that have been ordered at least once. C) Select the products that have been ordered at least twice. D) An error message.arrow_forward
- SQL DML/DDL There are five tables describing employees of a company, departments, buildings, which department(s) an employee works in (and a percentage of the time for each), and in which building an employee works (an employee may have more than one office). The primary key of each table is the attribute(s) in capitals and underlined. The foreign keys are in italics. Other attributes are not necessarily unique.Employee (EID, Ename, Salary, Start_Date, End_Date)Building (BID, Bname, Address)Department (DID, Dname, Annual_Budget)In_Department (EID, DID, Percentage_Time)In_Building (EID, BID)Write the SQL statements for the following.1. Find the names of Departments where NO employees work. 2. For employees who are still working in the company, end date has no value (empty). For those who have left the company and have end date values, show their names and the duration of their employment in years. 3. Find the names of buildings where more than 50 employees work. 4. The tables have…arrow_forward4. In the OrderItems table, display a count of the number of products, grouped by prod_id, but only for those groups having 3 or more of a given prod_id. Display the count with the alias shown. Sort by prod_id in ascending order. BNBG01 BNBG02 BNBG03 BR03 4 rows returned in 0.00 seconds PROD_ID Download 3 3 3 4 NUM_PROD_IDarrow_forwardLab #9 – Joining Data From Multiple Tables List the order number and order date for every order that was placed by Mary Nelson and that contains an order line for an iron. Use an INTERSECT operator. Lab #10 – Sub Queries Find the sales rep number, last name, and first name for every sales rep who represents at least one customer with a credit limit of $2000. List the order number and order date for every order that was placed by Mary Nelson and that contains an order line for an iron. Down below are the tables ORDER_LINE ORLN_ORDER_NUMBER ORLN_PART_NUMBER ORLN_NUMBER_ORDERED ORLN_QUOTED_PRICE ORDER_TABLE ORDR_ORDER_NUMBER ORDR_ORDER_DATE ORDR_CUSTOMER_NUMBER CUSTOMER CUST_NUMBER CUST_LAST CUST_FIRST CUST_STREET CUST_CITY CUST_STATE CUST_ZIP_CODE CUST_BALANCE CUST_CREDIT_LIMIT CUST_SALES_REP_NUM PART PART_NUMBER PART_DESCRIPTION UNITS_ON_HAND…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY

Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON

Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education

Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY