Question

In: Computer Science

Give the tuple calculus expressions for each using the below schema: Make a database up if...

Give the tuple calculus expressions for each using the below schema: Make a database up if needed

SPERSON(EmpID, Name, Dept)

TRIP(TripID, EmpID, ToCity, StartDate, EndDate)

EXPENSE(ExpID, TripID, AccountID, Amount)

a) List the names and employee ID of a salesperson.

b) List employee ID and employee names that took a trip(s) to New York city.

c) List the names of all employees who have spent more than $700 on their trip.

d) List employees' names and their IDs that have never taken a trip.

e) List the names of all salespersons that have at least been on one trip.

Solutions

Expert Solution

Please vote if you find this solution helpful :)

a) List the names and employee ID of a salesperson.

select EmpID,Name from SPERSON; => (this will return all the rows in table SPERSON)
select EmpID,Name from SPERSON where EmpID=*;
=> (The question says names and employee ID of 'a' person, so replace * with EmpID to return a specific person details.

b) List employee ID and employee names that took a trip(s) to New York city.

select EmpID,Name from SPERSON s,TRIP t where s.EmpID=t.EmpID and t.ToCity='New York city';

c) List the names of all employees who have spent more than $700 on their trip.

select EmpID,Name from SPERSON s,TRIP t,EXPENSE e where s.EmpID=t.EmpID and t.TripID=e.TripID HAVING e.Amount>$700;

d) List employees' names and their IDs that have never taken a trip.

select EmpID,Name from SPERSON s,TRIP t where s.EmpID=!t.EmpID;

e) List the names of all salespersons that have at least been on one trip.

select EmpID,Name from SPERSON s,TRIP t where s.EmpID=t.EmpID;

thank you.


Related Solutions

Given the below relational algebra expressions, use domain and tuple relational calculus to specify them: a....
Given the below relational algebra expressions, use domain and tuple relational calculus to specify them: a. σx=z ( R(a,b,c) ) b. πx,y ( R(x,y,z) ) c. R(x, y) / S(x) d. R(a,b,c) ∪  S(a,b,c) e. R(a,b,c) – S(a,b,c) f. R(d,e,f) ∩ S(d,e,f) g. R(x,y,z) × S(f,g,t)
using the lyrics database schema in mysql provided below. 1.)List the artist name of the artists...
using the lyrics database schema in mysql provided below. 1.)List the artist name of the artists who do not have a webaddress and their leadsource is “Directmail”? 2.)List the names of members in the artist called 'Today'. 3.)Report the total runtime in minutes FOR EACH album in the Titles table. 4.)List the firstname, lastname of members who are represented by the salesperson “Lisa Williams” 5.)List EACH salesperson’s firstname along with the number of Members that EACH SalesPerson represents. below is...
7. Using the provided schema of a Purchase Order Administration database, write the following queries in...
7. Using the provided schema of a Purchase Order Administration database, write the following queries in SQL. (In the schema, bold attributes are primary keys and italicized attributes are foreign keys.) SUPPLIER (SUPNR, SUPNAME, SUPADDRESS, SUPCITY, SUPSTATUS) SUPPLIES (SUPNR, PRODNR, PURCHASE_PRICE, DELIV_PERIOD) PRODUCT (PRODNR, PRODNAME, PRODTYPE, AVAILABLE_QUANTITY) PO_LINE (PONR, PRODNR, QUANTITY) PURCHASE_ORDER (PONR, PODATE, SUPNR) 7d) Write a nested SQL query to retrieve the supplier number, supplier name, and supplier status of each supplier who has a higher supplier status...
Using draw.io diagram tool, design a database schema for an application that tracks and manages students’...
Using draw.io diagram tool, design a database schema for an application that tracks and manages students’ applications for a university. Make sure to create proper primary key for each entity. Add relations and specify cardinalities. All entities and attributes must be named using the underscore convention. Highlight primary keys in red List any assumptions you have made Use diamonds and the association on the arrow. THINGS TO KEEP IN MIND : The university needs to keep track of students’ application....
. Give an example of a string represented by each of the following regular expressions •...
. Give an example of a string represented by each of the following regular expressions • 0+ 1+ (11)* 0? • [0-9]+ ( (E|e) (\+|\-)? [0-9]+ )? • ([a..z] ([a..z] | [0..9])*)
using mysql and the schema is provided below. thanks In this lab, you will be manipulating...
using mysql and the schema is provided below. thanks In this lab, you will be manipulating the database to add, delete and modify the values in the database. Please use a "select * from..." after each query to show the effects of your data manipulation query. 1. The title 'Time Flies' now has a new track, the 11th track 'Spring', which is 150 seconds long and has only a MP3 file. Insert the new track into Tracks table (Don’t hand-code...
For each of the following Perl regular expressions, give a complete and precise description of the...
For each of the following Perl regular expressions, give a complete and precise description of the function of the regular expression, plus a related example string: (a) /"([^"]*)"/ (b) /[-+]?\d+(\.\d*)?F\b/ (c) /(\D{2,}).*\[\1\]/ (d) /((.*?)\d)\s\2/ (e) /^[0-9]+\/\d+([+\-*\/]\=|([+]{2}|[-]{2}));$/
Database: Question 11 Using the ERD from problem 10, create the relational schema.(Create an appropriate collection...
Database: Question 11 Using the ERD from problem 10, create the relational schema.(Create an appropriate collection of attributes for each of the entities. Make sure you use the appropriate naming conventions to name the attributes.)
Database exercise: inpatient cases Create database using name RUMKIT Create tables below in that database patient(idPatient,...
Database exercise: inpatient cases Create database using name RUMKIT Create tables below in that database patient(idPatient, fullName, biologicalMother, birthdate, address) doctor(idDr, fullName, specialization, consulRates) inpatient(idPatient, entryTime, outTime, idDr, idRoom). Please make entryTime as column that is going to be filled automatically when care record is being add room(idRoom, roomName, cost) fill the data above to each table Create sql query and relational algebra expressions for the query Please give me detailed answer so I could learn from it. Thank you...
Listed below is the relational database schema for an online store(SQL/Java): MEMBER(last_name, first_name, email, password, user,street,...
Listed below is the relational database schema for an online store(SQL/Java): MEMBER(last_name, first_name, email, password, user,street, city, state, zip, card_type, card_no, expiration, name_on_card) book_SALE(listing_no, seller, isbn, condition, price) ORDERS(order_no, buyer, order_date, tot) ITEM(order_no, listing_no) BOOK(isbn, title, author, edition, publisher, keywords) The bold attribute(s) in a relation is the primary key of that relation. The italized attributes in some relations denote foreign keys. The seller attribute in the book_SALE relation is a foreign key to the user attribute in the MEMBER...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT