Page 1 of 1

Example databases LibraryCustomer (name, phone, email, libraryCardNumber) Library Item (ID, loanPeriod) Book (ID, title,

Posted: Fri Apr 29, 2022 6:39 am
by answerhappygod
Example Databases Librarycustomer Name Phone Email Librarycardnumber Library Item Id Loanperiod Book Id Title 1
Example Databases Librarycustomer Name Phone Email Librarycardnumber Library Item Id Loanperiod Book Id Title 1 (292.61 KiB) Viewed 59 times
Example Databases Librarycustomer Name Phone Email Librarycardnumber Library Item Id Loanperiod Book Id Title 2
Example Databases Librarycustomer Name Phone Email Librarycardnumber Library Item Id Loanperiod Book Id Title 2 (110.91 KiB) Viewed 59 times
Example databases LibraryCustomer (name, phone, email, libraryCardNumber) Library Item (ID, loanPeriod) Book (ID, title, author, language, year) CD (ID, title, artist, year, length) DVD (ID, title, year, length) Loan (itemID, libraryCardNumber, startDate, endDate, returned). The library database consists of six relations. The relation LibraryCustomer contains the information about library customers. Each customer is identified using the attribute libraryCardNumber. The relation Item contains all possible loanable items and tells the loan period for the item. Loanable items can be books, CDs, or DVDs and each have their own relation, Book, CD, and DVD, respectively. The ID in Item matches one ID in Book, CD, or DVD. The relation Loaned contains the past and current information about loaned items. The attribute returned is O if the item is not yet returned and 1 if it is. Customers (email, name, address, birthday) Product (prodID, description, price, weight, type) Orders (order ID, customer, date, payment) OrderContent (orderID, product, amount). This is the schema for the online shop. The relation Customers contains the information about customers, each tuple with a unique email. The relation Product contains the product information. The attribute type can be "food”, ”hygiene”, ”hobby", or "kitchen”. The relation Orders keeps track of the orders of the customers, with a unique orderID. The attribute customer contains the email of the customer making the order. The date of the order is in the format "YYYY-MM-DD”. The attribute payment is "credit", "paypal", or "mobilepay". The relation OrderContents tells which products belong to which order, and the amount of the products in the order. Doctor (id, name, email) Patient (ssNo, name, birthday, heights, weight, phone, vaccine) Appointment (patient, doctor, date, description). These are the relations in the hospital database. The relation Patient contains the information about patients. The attribute vaccine takes the value 1 if the patient has had the corona vaccine and 0 otherwise. The relation Doctor contains the working ID, name, and email of a doctor. The relation Appointment stores the information about appointments between doctors and patients. It is assumed that a patient can meet a specific doctor only once a day. The attribute description in Appointment can take values "checkup”, "acute", "treatment", and " vaccine", describing on the nature of the appointment. Relational algebra expressions 1. (1p.) Consider the library database. Write a relational algebra expression to aswer the following query: find the title and author of all books released after the year 2000. 2. (1p.) Consider the library database. Write a relational algebra expression to aswer the following query: find the names, phone numbers, and emails of the customers that have unreturned loans. 3. (1p.) Consider the online store database. Write a relational algebra expression to aswer the following query: find descriptions, prices, and weights of the products with price lower than 5.0e and type " hygiene".
4. (1p.) Consider the online store database. Write a relational algebra expression to aswer the following query: find product IDs, product descriptions, amounts, and dates of products that appear in some of of the orders. 5. (1p.) Consider the hospital database. Write a relational algebra expression to aswer the following query: find the social security numbers and phone numbers of all patients who have appointments between 26.4.2021 and 2.5.2021. 6. (1p.) Consider the hospital database. Write a relational algebra expression to aswer the following query: find the social security numbers, names, and phone numbers of patients who are born before 1961 and who have not yet been vaccinated and don't have an appointment of type "vaccine”. 7. (2p.) Consider the library database. Write a relational algebra expression to aswer the following query: find the titles and return dates of items that have not yet been returned.