Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask DBMS Expert


Home >> DBMS

Consider the following instance of this database. The Primary key (PK) and Foreign Keys (FK) are identified for each table.

Table: EMPLOYEE

PK: employeeID;

FK: empBranch references BRANCH;

FK: empSupervisor references EMPLOYEE

 

EMPLOYEEID

EMPLNAME

EMPFNAME

EMPTITLE

EMPSTARTDATE

EMPBRANCH

EMPSALARY

EMPSUPERVISOR

e1

Adam

Alan

CEO

11-JAN-02

b1

600000

-

e2

Bryson

Brad

branch_manager

01-FEB-03

b2

400000

e1

e3

Clay

Cedric

branch_manager

21-JUN-01

b3

450000

e1

e4

Day

Daisy

branch_manager

17-AUG-03

b4

480000

e1

e5

Engle

Eva

salesperson

01-JAN-04

b2

120000

e2

e6

Falcon

Fred

salesperson

01-JAN-02

b2

80000

e2

e7

Gandhi

Gagan

salesperson

01-JAN-03

b3

90000

e3

e8

Hee

Hwang

salesperson

01-JUN-04

b3

95000

e3

e9

Ingram

Irene

salesperson

24-SEP-02

b4

110000

e4

e10

Jerome

John

salesperson

25-AUG-02

b4

75000

e4

 Table: BRANCH

PK: branchNumber

FK: branchManager references EMPLOYEE

BRANCHNUMBER

BRANCHNAME

BRANCHSTREET

BRANCHCITY

BRANCHSTATE

BRANCHZIP

REVENUETARGET

BRANCHMANAGER

b1

branch1

9700 NW 41 St

Miami

FL

33178

800000

e1

b2

branch2

8700 SW 24 St

Miami

FL

33170

600000

e2

b3

branch3

E 200 47 St

New York

NY

11010

1000000

e3

b4

branch4

300 Park Avenue

New York

NY

10010

1200000

e4

Table: CUSTOMER

PK: customerID

CUSTOMERID

CUSTNAME

CUSTSTREET

CUSTCITY

CUSTSTATE

CUSTZIP

CUSTPHONE

c1

cust1

-

Miami

FL

33164

-

c2

cust2

-

Miami

FL

33120

-

c3

cust3

-

Miami

FL

33110

-

c4

cust4

-

Miami

FL

33178

-

c5

cust5

-

New York

NY

11021

-

c6

cust6

-

New York

NY

11001

-

Table: PRODUCT

PK: productCode

PRODUCTCODE

PRODDESCRIPTION

PRICE

STOCKLEVEL

p1

carpet

40

10000

p2

tile

20

100000

p3

pergo

50

50000

 Table: INSTALLATION

PK: installationType

INSTALLTYPE

INSTALLDESCRIPTION

RATE

i1

carpet installation

40

i2

tile installation

50

i3

pergo installation

60

Table: ORDERS

PK: orderNumber

FK: customerID references CUSTOMER;

FK: salesPerson references EMPLOYEE

 

ORDERNUMBER

ORDDATE

SALESPERSON

CUSTOMERID

o1

12-AUG-07

e5

c1

o2

14-DEC-07

e5

c2

o3

04-NOV-07

e5

c3

o4

15-AUG-07

e5

c4

o5

22-NOV-07

e10

c5

o6

01-JUL-07

e10

c6

o7

12-DEC-07

e6

c6

o8

30-NOV-07

e9

c2

  Table: PRODLINE

PK: orderNumber + prodCode

FK: orderNumber references ORDERS;

FK: prodCode references PRODUCT

ORDERNUMBER

PRODCODE

QUANTITY

o1

p1

1000

o1

p2

500

o2

p3

200

o3

p1

600

o3

p3

100

o4

p2

1000

o5

p2

800

 Table: INSTLINE

PK: orderNumber + instType

FK: orderNumber references ORDERS;

FK: instType references INSTALLATION

ORDERNUMBER

INSTTYPE

HOURS

o1

i1

20

o1

i2

30

o1

i3

10

o2

i1

10

o2

i2

20

o6

i1

20

o6

i2

10

o7

i3

10

o8

i2

20

Formulate SQL queries for the following (1 -6) with reference to this database. Present your SQL query and the results returned for the specified instance of the database. Your queries should work for EVERY instance of the database (and not just for the instance specified in this document).


(1) For each employee with a salary greater than $120,000, list the employee's id (employeeid), last name (emplname), and salary (empsalary) as "high_salary". Records should appear in descending order of salary.


(2) For each branch list the branchnumber and the sum total of salary paid to all employees working for that branch as "branch_payroll". Records should appear in descending order of branchnumber.


(3) List the order number, order date (orddate), and customer id (customerid) for all orders placed by customers located in the state of New York ( 'NY'). Records should appear in descending order of order number.


(4) For each order, list the ordernumber and the total revenue generated from installation services as "installation_revenue". Installation revenue for an order is computed as the sum of the hours times the rate of all installation services sold as part of that order.


(5) For each State list the "State_install_revenue" computed as the sum of the installation revenue (as defined in query 4 above) from all orders placed by customers located in that state (custstate).


(6) Under a column header "install_only_orders", list the order numbers for orders that include installation services but do not include any products.

DBMS, Programming

  • Category:- DBMS
  • Reference No.:- M91420435
  • Price:- $20

Priced at Now at $20, Verified Solution

Have any Question?


Related Questions in DBMS

Question team project submission - submit to the unit 4

Question: Team Project Submission - Submit to the Unit 4 Group Project Area This version of the capstone project assignment is FOR GRADING this week. Submit to the group area the document containing completed Sections On ...

Project outline and requirements provide a brief

Project Outline and Requirements Provide a brief description of the organization (can be hypothetical) that will be used as the basis for the projects in the course. Include company size, location(s), and other pertinent ...

Question create the physical data model for the logical

Question: Create the physical data model for the logical data model that you submitted in IP3. This should include all of the data definition language SQL. Your submission should include all DDL needed to: Create the tab ...

Analytic reportpurpose the purpose of this task is to

Analytic Report: Purpose: The purpose of this task is to provide students with practical experience in working in teams to write a Data Analytical report to provide useful insights, pattern and trends in the chosen/given ...

You are responsible for keeping track of meal expenses for

You are responsible for keeping track of meal expenses for ten employees while at a business lunch to which your employer has invited you to attend. Write an algorithm that inputs the lunch costs for each the ten employe ...

Database design and development assignment -assessment task

Database Design and Development Assignment - Assessment task - 1. Normalization a) Map the ERD, from the sample solution, into a set of relations in at least Third Normal Form (3NF). You must ensure that your relations m ...

Suppose that we have a table of house prices and a table of

Suppose that we have a table of house prices and a table of zip codes: • hprices(hid (PK),address,bedrooms,price,zipcode) • zipcodes(zipcode (PK),state) Write a SQL query that finds the average, maximum, and minimum pric ...

Instructionsfor decades relational databases remained

Instructions For decades, relational databases remained essentially unchanged; data was segmented into specific chunks for columns, slots, and repositories, also called structured data. However, in this Internet of Thing ...

Assignment task -write and run sql statements to complete

Assignment Task - Write and run SQL statements to complete the following tasks Part A - DML 1. Show the details of the products where the product code starts with '22'. 2. Display the vendor details from areacode 615. 3. ...

Question as explained throughout this course entity

Question: As explained throughout this course, entity relationship modeling is a critical element of database design. If the database is not properly modeled, it is unlikely that the database will be properly developed. ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As