Question

In: Computer Science

Given the following relations: PARTS(Pno, Pname, Qoh, Price, Olevel) CUSTOMERS(Cno, Cname, Street, Zip, Phone) EMPLOYEES(Eno, Ename,...

Given the following relations:

PARTS(Pno, Pname, Qoh, Price, Olevel)
CUSTOMERS(Cno, Cname, Street, Zip, Phone)
EMPLOYEES(Eno, Ename, Zip, Hdate)
ZIP_CODES(Zip, City, State)
ORDERS(Ono, Cno, Eno, Received, Shipped)
ODETAILS(Ono, Pno, Qty)

Where Qoh stands for quantity on hand and Olevel stands for (re)order Level. The P, C, E and O single letter prefixes for attributes refer to the parts, customers, employees and orders relations, respectively.

a. Retrieve the names of customers who have ordered parts costing less than $150.00.

b. Retrieve the names of customers and the Pname of orders with a qty greater than 10.

For the above queries, draw an initial relational algebra query tree then transform the initial query tree created into a more efficient form using heuristic rules. Show your optimization one step at a time and explain the rationale of each optimization.

Solutions

Expert Solution

Answer A)-

The relation algebra query- (∏?????(??????.???=????????.??? Ո ????????.???=??????.??? Ո ?????????.???=??????.??? Ո ?????<150.00(????? ? ?????? ? ?????????))

Answer B)-

The relation algebra query- (∏?????,?????(??????.???=????????.??? Ո????????.???=??????.??? Ո ?????????.???=??????.??? Ո ???>10(????? ? ???????? ? ?????? ? ?????????))

  1. — draw an initial relational algebra query tree for A and B -  

A)-

B)-

  1. The initial query tree created into a more efficient form using heuristic rules.
  • Avoid cross-product operation
  • simplify number of tuples usable for join by executing select & project works earlier join operations

​​​​​​​

Note- Please do upvote, if any problem then comment in box sure I will help.


Related Solutions

Database Normalize the relations to BCNF: Member- (MemID, dateJoined, firstName, lastName, street, city, state, zip, areaCode,...
Database Normalize the relations to BCNF: Member- (MemID, dateJoined, firstName, lastName, street, city, state, zip, areaCode, phoneNumber, currentOfficeHeld) Play- (title, author, numberOfActs, setChanges) Sponsor- (sponID, name, street, city, state, zip, areaCode, phoneNumber) Subscriber- (subID, firstName, lastName, street, city, state, zip, areaCode, phoneNumber) Production- (prodyear, seasonStartDate, seasonEndDate, title) Performance – (perfyear,perfdate, time, seasonStartDate) TicketSale- (saleID, saleDate, totalAmount, perfyear, perfdate,subID) DuesPayment- (MemID, duesYear, amount, datePaid) Donation – (sponID, donationDate, donationType, donationValue, prodYear, seasonStartDate) Ticket- (saleID, seatLocation, price, type) Member - Production-(MemID, prodYear,...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname,...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname, major-dept, year) Courses (cid, cname, dept, credithours) Enrollment (sem-year, sid, cid, grade) Teaches (pid, cid, sem-year, class-size) where, Professors: All professors have professor id (pid), name (pname), department that they work (dept), and a phone number extension for their office (ext). Students: All students have id (sid), name (sname), department for their major (major-dept), and a year (year i.e, freshman, sophomore, junior, etc). Courses:...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname,...
Consider the University Database with the following relations: Professors (pid, pname, dept, ext) Students (sid, sname, major-dept, year) Courses (cid, cname, dept, credithours)Enrollment (sem-year, sid, cid, grade) Teaches (pid, cid, sem-year, class-size), Professors: All professors have professor id (pid), name (pname), department that they work (dept), and a phone number extension for their office (ext). Students: All students have id (sid), name (sname), department for their major (major-dept), and a year (yeari.e, freshman, sophomore, junior, etc). Courses: All courses have...
Given the following 7 relations: MIScompany (name, address, phone, email, FedTaxId, StaTaxId) branch (branchId, name, address,...
Given the following 7 relations: MIScompany (name, address, phone, email, FedTaxId, StaTaxId) branch (branchId, name, address, phone, email, FedTaxId, StaTaxId) employee (empId, driverId, ssno, name, branchId) customer (custId, name, address, driverId, ssno, FedTaxId, StaTaxId) equipment (equipId, name, type, upc, purchaseDate, year, manufacturId, cost, rentFee, branchId ) manufacturer (manufacturId, name, FedTaxId, StaTaxId, phone, email) rental (rentalId, equipId, custId, rentDate&time, returnDate&time, empId) Use relational algebra to retrieve every customer that has not rented any equipment in September 2020. The report should contain...
INRO TO DATABASES Consider the following Schema: Suppliers(sid: integer, sname: string, address: string) Parts(pid: integer, pname:...
INRO TO DATABASES Consider the following Schema: Suppliers(sid: integer, sname: string, address: string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) The Catalog relation lists the prices charged for parts by Suppliers. Write the following queries in SQL using join, nested queries and set operators. 1. Find names of suppliers who supply every red or green part. 2. Find the sids of suppliers who supply every red part or supply every green part. 3. Find sids...
Consider the following schema: Suppliers (sid, sname, address) Parts (pid, pname, colour) Catalog(sid, pid, cost) The key for Suppliers is sid, for Parts is pid, and for Catalog is sid and pid The Ca...
Consider the following schema: Suppliers (sid, sname, address) Parts (pid, pname, colour) Catalog(sid, pid, cost) The key for Suppliers is sid, for Parts is pid, and for Catalog is sid and pid The Catalog relation associates prices charged for parts by suppliers. Write the following queries using relational algebra. For items (a) through (e), use the "sequences of assignments" form. For items (f) and (g), use the "expression tree" form. List all assumptions. (Some marks will be given for the quality of your answers.) (a) Find...
1. Which of the following is not a stakeholder in a business? employees suppliers customers competitors...
1. Which of the following is not a stakeholder in a business? employees suppliers customers competitors 2. Which of the following does NOT describe managerial accounting? not generally released to the public various formats are used used for the SEC filings used primarily for internal making 3. Jones company makes two products A & B. Here is some financial information about those products.                          A    B     Combined total cost of cost drivers Direct labor    $45,000 $35,000 Direct...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone...
Problem: Read the following tables and answer the following questions: Customers Customer ID Name Address Phone Email 9087 John Doe 204 University Ave. 987-098-9087 [email protected] 2098 Bill Lawrence 123 Jones St 717-387-3387 Business 2398 Laura Smith 0900 West Blvd. 901-234-4567 Information Transactions Customer ID Account Number Date of Last Transaction 9087 375 01/31/98 2098 123 03/09/97 2398 375 09/21/97 2098 375 12/31/97 2398 123 02/01/98 Accounts Account Number Balance Account Type 375 234.45 Checking 123 056.90 Savings 1. Who owns...
Given the following tables: Aircraft (ano, amodel, mfgYr) Fleet (fno, src, dest, ano, pno) Pilot (pno,pname,gender)....
Given the following tables: Aircraft (ano, amodel, mfgYr) Fleet (fno, src, dest, ano, pno) Pilot (pno,pname,gender). Write Relational Algebra Query for the following. (i) Find those female pnames who has not taken a fleet dest of ‘Alabama’ but taken a fleet src to ‘Bahama’ (ii) Retrieve the fno, amodel of the aircraft manufactured in 2015 that the male pilot has had a flight on
QUESTION 1 Which of the following is not a transaction category? Banking Employees and Payroll Customers...
QUESTION 1 Which of the following is not a transaction category? Banking Employees and Payroll Customers and Sales Company Preferences 4 points    QUESTION 2 Which report summarizes what a company has earned and the expenses incurred to earn the income? Balance Sheet Statement of Cash Flows Accounts Payable Report Profit and Loss Statement QUESTION 3 What is the primary objective of accounting? The primary objective of accounting is to provide information to the Internal Revenue Service (IRS) to ensure the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT