-1

I have three schemas:

SUPPLIER(SNO,SNAME,STATUS,CITY)
PROJECT(JNO,JNAME,CITY)
SPJ(SNO,JNO,QTY)

The query is:

Get jno values for projects supplied to any Project in 'BOMBAY' by Supplier in 'DELHI'.

How do I write this query in Relational Algebra?

philipxy
  • 14,867
  • 6
  • 39
  • 83
AMAN SINGH
  • 11
  • 3
  • Hi. Please read & act on [ask], hits googling 'stackexchange homework' & the downvote arrow mouseover text. Now you are just asking us to rewrite your textbook & give a bespoke tutorial & do your homework--that is too broad a question. Give the name & edition of your published academic textbook. Show your work following it. The first place you are stuck, explain about why. What examples are like your question? PS There are many different relational algebras. Give a reference to yours. PS [Re relational querying.](https://stackoverflow.com/a/24425914/3404097) PS This is obviously a faq. – philipxy Oct 19 '18 at 05:19
  • Please click on 'edit' & read the the edit help & see how your question has been formatted. Learn about code & quote formating (block & inline) & 2 spaces before a newline as line break. – philipxy Oct 19 '18 at 05:20

1 Answers1

0

Aman, welcome to StackOverflow. Here's a possible answer:

WITH SSUPPLIER := SUPPLIER RENAME {SCITY := CITY}
     PPROJECT  := PROJECT  RENAME {PCITY := CITY}
:
JOIN( SSUPPLIER, PPROJECT, SPJ )
WHERE PCITY = 'BOMBAY' AND SCITY = 'DELHI'
{ JNO }

(This is using the Tutorial D variety of Relational Algebra, as described in the textbooks of Chris Date & Hugh Darwen. I see that the given schemas are taken from those books.)

As Philipxy points out, it's a good idea to say what textbook you are using, and what variety of RA.

AntC
  • 2,623
  • 1
  • 13
  • 20