Question

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]

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

1) Query in Relational Algebra :

?pname ?pno in (?pno?dest=Spookers ^ did=(?did?car_type=Trabant)) (PASSENGER XTRIP X DRIVER)

where ? represents select and ? represents conditionality

2) Query in safe domain relational caluculus :

QSpeakers,Trabant= {pname? PASSENGER(pame) ? (pno=TRIP(pno,dest='Spookers' ^ did=DRIVER(did,CAR_type=Trabant))}

3) Query in SQL :

select pname from PASSENGER where pno in (select pno from TRIP where dest='Spookers' and did=(

select did from DRIVER where car_type='Trabant'))

Add a comment
Know the answer?
Add Answer to:
2. Queries. Consider the following schema for a relational database. The schema models which Uber drivers...
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
  • 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...

    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...

  • Consider the following relational schema as part of a university database: -age-sex-s-q339281 39 Prof(sin, pname, oce,...

    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...

  • 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 fo...

    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,...

  • Consider following relational database schema and translate the queries ‘a’ and ‘b’ into relational algebra expressions...

    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

  • 1. Shown below is the relational database schema for a database which contains details regarding bus...

    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....

  • (a) When implementing a relational database schema in SQL, does it matter in which order you crea...

    (a) When implementing a relational database schema in SQL, does it matter in which order you create tables? Hint: suppose that foreign keys exist. (b) Explain the options available for enforcing a foreign key constraint when creating a foreign key, and what effects they have. What is the default option?

  • Consider the relational database schema for a company below. EMPLOYEE/NAME, SSN, BDATE, ADDRESS, SEX, SALARY, SUPERSSN,...

    Consider the relational database schema for a company below. EMPLOYEE/NAME, SSN, BDATE, ADDRESS, SEX, SALARY, SUPERSSN, DNA) TA DEPARTMENT(DNAME, DNUMBER. MESSINS, MGRSTARTDATE) DEPT_LOCATIONS(DNUMBER. DLOCATION PROJECT(PNAME, PNUMBER. PLOCATION, DNLIM) WORKS_ONCESSN.PNG, HOURS) DEPENDENTESSN, DEPENDENT-NAME, SEX, BDATE, RELATIONSHIP) Write SQL statements for the following queries: a) List the names of those employees who work in the "Production" department (6 marks). b) Find the maximum salary, minimum salary, and the average salary among employees who work for the "Production department (6 marks). Count the...

  • Given the following relational schema, write queries in SQL to answer the English questions. There is...

    Given the following relational schema, write queries in SQL to answer the English questions. There is a shipment database on the MySQL server. You can also use the DDL for MySQL. You must only submit the SQL for your answers but you can include the query output as well to help the TA with marking. Customer(cid: integer, cname: string, address: string, city: string, state: string) Product(pid: integer, pname: string, price: currency, inventory: integer) Shipment(sid: integer, cid: integer, shipdate: Date/Time) ShippedProduct(sid:...

  • - Consider the following relational schema. - Write SQL statements for the following queries employee fname...

    - Consider the following relational schema. - Write SQL statements for the following queries employee fname CHARACTER VARYING (15) minit CHARACTER VARYING(1) InameCHARACTER VARYING(15) essn CHARACTERO) bdate DATE address CHARACTER VARYING(50) dependent works on CHARACTERO dependent name CHARACTER VARYING(15) essn CHARACTER(9) pno NUMERIC hours NUMERIC CHARACTER() DATE CHARACTER VARYING(B) bdate CHARACTER(1) dept locations elationship salary NUMERIC super ssn CHARACTERO) dno dno NUMERIC dlocation CHARACTER VARYING(15) NUMERIC department CHARACTER VARYING(25) NUMERIC CHARACTERO) project dno mgssn mgstartdate DATE pname CHARACTER VARYING(25) pno...

  • Please HELP, THANK YOU SO MUCH Consider the below schema of the university database (keys are...

    Please HELP, THANK YOU SO MUCH Consider the below schema of the university database (keys are in bold and underline) Part(pid: string, pname: string, description: string, color: string) Department(did: string, dnamestring, address: string) Supplier(sid string,.sname:string, address:string) Order(did:string. sid string pidstring, time:string, quantityreal, pricereal) The key fields are underlined, and the domain of each field is listed after the field name. Thus pid is the key for Part, did is the key for Department, sid is the key for Supplier, and...

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
ADVERTISEMENT