i have entity sets
account(account-number, balance)
branch(branch-name, branch-city, assets)
customer(customer-name, customer-street, customer-city)
loan(loan-number, amount)
and relationship sets
account-branch(account-number, branch-name)
depositor(customer-name, account-number)
borrower(customer-name, loan-number)
loan-branch( loan-number, branch-name)
how do i write a relational algebra query to find the names of the customers who have a deposit at branches located in their city?
2 6310
i have entity sets
account(account-number, balance)
branch(branch-name, branch-city, assets)
customer(customer-name, customer-street, customer-city)
loan(loan-number, amount)
and relationship sets
account-branch(account-number, branch-name)
depositor(customer-name, account-number)
borrower(customer-name, loan-number)
loan-branch( loan-number, branch-name)
how do i write a relational algebra query to find the names of the customers who have a deposit at branches located in their city?
- PROJECT customer-name (select account-number(depositor natural join (select customer.customer-city=branch.branch-city(customer natural join branch))))
Assume a bookshop has database with the following schema of six relations:
Authors (au_id, au_lname, au_fname, phone, address)
Publishers (pub_id, pub_name, city, state, country)
Sales (stor_id, ord_num, qty, title_id)
Stores (stor_id, stor_name, stor_address, city, state, zip)
Titleauthor (au_id, title_id, royaltyper, au_ord)
Titles (title_id, title, type, pub_id, price, pubdate)
Write the following queries in relational algebra:
i. List the authors first and last names for the book titled ‘Life Without Fear’
ii. List the titles of the books sold at Barnum’s. (stor_name)
iii. Give the last names (au_lname) and au_ids of the authors whose books have sold in the store named Barnum’s. Assign an alias to your answer.
iv. Using your alias from the previous problem, give the last names and au_ids of the authors whose books have not sold in the store named Barnum’s
v. List the titles of books, which have not sold any copies at any store (no books sold at all.)
vi. List the titles of the books, which have only sold at Barnum’s. (Do not list the books, which have not sold anywhere.)
vii. List the titles of the books, which have sold at both Barnum’s and Bookbeat. (Two stor_names)
viii. List the titles and stor_names for each book when the book has sold and the title only (with null for the stor_name) if the book has not sold. (Use an outer join.)
ix. List the stor_ids of the stores which have sold all books published by New Moon Books (pub_name)
x. List the titles of the books, which have sold at all stores.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: |
last post by:
I need to write a relational algebra query for the following:
Show the item_ID, item description and category description for all items
where the supplier uses "rail" as the delivery_method.
...
|
by: Vishy8015 |
last post by:
Use Relational Algebra to express the following queries on the schema FLIGHTS (DepartureCity, ArrivalCity). A pair of cities a, b is in an instance of relation FLIGHTS if there is a direct flight...
|
by: scorpiomailin |
last post by:
Hello Guys...
thanks in advance jst wondering if any1 knows answer to this....
if this is the SQL query
Author(name, hometown, publisher)
Textbook(tname, aname, price)
select A.name, publisher...
|
by: lava4112 |
last post by:
Have a test on SQL, only teacher wants to know what type of relational algebra is a select, where, from--I have no idea and can not understand the teacher.
We are using Concepts of Database...
|
by: salman malik |
last post by:
software for relational algebra.
|
by: aiom |
last post by:
following are the given set of relations
:
STUDENT(SSN,Name,Major,Bdate)
COURSE(Course#,CName,Dept)
EnrollCourse#,Quarter,Grade)
BOOK_ADOPTION(Course#,Quarter,Book_ISBN)...
|
by: muniba |
last post by:
Relational algebric expression for the following:
Draw two relational algebra query trees for the following query and show that one query tree is more eficient than the other.
"Give the number...
|
by: Metallicat |
last post by:
I have been posed and attempted to answer several questions but I do not seem to be getting anywhere. I have emailed my tutor a week ago and he has not responded, If anyone can take a look and help...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
| |