473,802 Members | 1,937 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

relational algebra queries

1 New Member
i have entity sets
account(account-number, balance)
branch(branch-name, branch-city, assets)
customer(custom er-name, customer-street, customer-city)
loan(loan-number, amount)

and relationship sets
account-branch(account-number, branch-name)
depositor(custo mer-name, account-number)
borrower(custom er-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?
Feb 28 '06 #1
2 6345
bhavna
1 New Member
i have entity sets
account(account-number, balance)
branch(branch-name, branch-city, assets)
customer(custom er-name, customer-street, customer-city)
loan(loan-number, amount)

and relationship sets
account-branch(account-number, branch-name)
depositor(custo mer-name, account-number)
borrower(custom er-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?
Expand|Select|Wrap|Line Numbers
  1.  PROJECT customer-name (select account-number(depositor natural join (select customer.customer-city=branch.branch-city(customer natural join branch))))
Sep 18 '07 #2
jumi
10 New Member
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.
Mar 3 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2561
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. The relations (tables) and attributes are as follows: Item (item_ID, description, category, price, qty_on_hand) Category (code, description, tax_rate) Supplied_by (item_ID, supplier, date, delivery_method)
0
1963
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 from city a to city b. The relation is always antireflexive: that is, there are no flights from a city to itself. a) Cities with flights to all cities from which there is exactly one flight. b) Cities with flights to exactly all cities from...
0
1373
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 from Author A, Textbook T where T.aname = A.name and not exists (select * from Textbook S where S. price > T.price);
1
3672
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 Management by Pratt No I understand quieries, but not relational algebra Any Help would be great
1
2044
by: salman malik | last post by:
software for relational algebra.
2
2254
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) TEXT(Book_ISBN,Book_Title,Publisher,Author) List any department that has all its adopted books publiched by 'ABC Publishing' in relational algebra.
1
2235
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 of treatments given by "Dr.Albert" for all the appointments made during the period January to June 2007" thanks
3
2845
Metallicat
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 me out I would be grateful. Two of the questions are below, if anyone can help with these two I'm sure that I can crack the rest! Find the first name, surnames and address of the patients that have had at least one operation with broken bones. ...
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10538
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10305
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.