Consider the following relational schema, representing a
database of documents and a set of keywords:
Doc(did, docTitle)
Occurs(did, wid)
Word(wid, word)
Keywords(word)
For each of the queries below, show an equivalent relational
algebra plan:
a.SELECT z.word, count(*) FROM Doc x, Occurs y, Word z WHERE x.did = y.did and y.wid = z.wid GROUP BY z.wid, z.word
b.SELECT x.did, x.docTitle FROM Doc x WHERE NOT EXISTS (SELECT * FROM Occurs o, Word w, Keyword k WHERE x.did = o.did AND o.wid = w.wid AND w.word != k.word );
Consider the following relational schema, representing a database of documents and a set of keywords: Doc(did,...
Consider following relational database schema and translate the queries ‘a’ and ‘b’ into relational algebra expressions Teacher(ID, Name, Designation, Phone, Address) Course(CourseCode, CourseName, CreditHour) Taught(TeacherID, CourseCode, Semester) a. SELECT Name, Address FROM Teacher, Taught WHERE Teacher.ID=Taught.TeacherID and CourseCode=’IT344’ b. SELECT CourseName FROM Course, Taught WHERE Course.CourseCode=Taught.CourseCode and TeacherID=200
2. Queries. Consider the following schema for a relational database. The schema models which Uber drivers drive which passengers to which destination at what time DRIVER-[did, dname, rating, car typej with key {did) PASSENGER-po, pname, email) with key pno) TRIP-did, pno, time, dest with key [did, time and foreign keys [did]CDRIVER[did pnoCPASSENGER pno]
1. Shown below is the relational database schema for a database which contains details regarding bus journeys from Tronoh to various destinations: BusOperator (opCode, opName) Journey(QpCode,GestinationCode price) Destination (destinationCode, destinationName, distance) a. Formulate the following queries using relational algebra: . Get the name of bus operators (e.g., Plusliner, Sri Maju etc.) that provide journeys which are priced at more than RM50.00. (3 marks ii. List the names of a destinations along with their prices provided by Plusliner. 3 marks] b....
Consider the following relational schema of the company’s database. Use Tuple Relational Calculus (TRC) & Domain Relational Calculus (DRC) expression to answer each of the following three questions (Step by step brief description is appreciated if possible) PRODUCT (pid, stock, supplier) CLIENT (cid, name, address, city) ORDER (orderno, date, quantity, pid, cid) Question 1: Find the number of orders for products that are being ordered in quantities smaller than 100 items by customers living in Madrid. Provide solutions expressed both...
Intro to database systems question:
Question2 (20 points, 5 points each) Consider the following relational schema as part of a university database Prof(sin, pname, o_ce, age, sex, specialty, dept did) Dept(did, dname, budget, num majors, chair sin) Assume the following queries are the most common queries in the workload for this university and they are almost equivalent in frequency and importance Assume that both B+ trees and hashed indexes are supported by the DBMS and that both single and multiple-attribute...
Question2 Consider the following relational schema as part of a university database: Prof(sin, pname, o_ce, age, sex, specialty, dept did) Dept(did, dname, budget, num_majors, chair_sin) Assume the following queries are the most common queries in the workload for this university and they are almost equivalent in frequency and importance: Assume that both B+ trees and hashed indexes are supported by the DBMS and that both single- and multiple-attribute index search keys are permitted. Specify the attributes you recommend indexing on,...
**************PLEASE COMPLETE PART F) ONLY************** Consider the following relational database schema (primary keys are underlined) and SQL query: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) SELECT g.guestNo, g.guestName FROM Room r, Booking b, Hotel h, Guest g WHERE h.hotelNo = b.hotelNo AND g.guestNo = b.guestNo AND h.hotelNo = r.hotelNo AND h.hotelName = "Ritz" AND dateFrom >= "Jan 01, 2001" AND dateTo <= "Dec 31, 2001"; (A) state what...
**************PLEASE COMPLETE PART E) ONLY************** Consider the following relational database schema (primary keys are underlined) and SQL query: Hotel (hotelNo, hotelName, city) Room (roomNo, hotelNo, type, price) Booking (hotelNo, guestNo, dateFrom, dateTo, roomNo) Guest (guestNo, guestName, guestAddress) SELECT g.guestNo, g.guestName FROM Room r, Booking b, Hotel h, Guest g WHERE h.hotelNo = b.hotelNo AND g.guestNo = b.guestNo AND h.hotelNo = r.hotelNo AND h.hotelName = "Ritz" AND dateFrom >= "Jan 01, 2001" AND dateTo <= "Dec 31, 2001"; (A) state what...
Consider the following relational schema as part of a university database: -age-sex-s-q339281 39 Prof(sin, pname, oce, age, sex, specialty, dept did) Dept(did, dname, budget, num majors, chair sin) ssume the following queries are the most common queries in the workload for this university and they are almost equivalent in frequency and importance ssume that both B+ trees and hashed indexes are supported by the DBMS and that both single- and multiple-attribute index search keys are permitted. Specify the attributes you...
consider the following relational database that records details
of parts and suppliers. Primary keys are underlined and the Foreign
Keys are identified with (FK).
Suppliers (sid, sname, address, credit)
Parts (pid, pname, color)
Catalog (sid (FK), pid (FK), cost)
The credit attribute denotes the size of the supplier’s credit
account. The Catalog relation lists the prices charged for parts by
Suppliers.
Which of the following queries returns the snames of suppliers who supply every part? Select one or more: a....