Question: Suppose I have a database table PRICE that keeps track of closing stock prices. It has 3 columns: ticker, date, and close. I want to

Suppose I have a database table PRICE that keeps track of closing stock prices. It has 3 columns: ticker, date, and close. I want to write a relational algebra expression that retrieves the tickers of all stocks that closed higher than 'IBM' (ticker) on the date '1/19/2016'.

I have written the following expression so far:

Suppose I have a database table PRICE that keeps track of closing

I feel like this is probably incorrect or there is a better way to write the expression. How would I fix this?

If it helps, I think the SQL query of this would be:

SELECT ticker FROM price WHERE date = 1/19/2016 AND close > (SELECT close FROM price WHERE date=1/19/2016 AND ticker=IBM)

So in essence, how would I translate this SQL query to a relational algebra expression?

? ticker(?date' 1/19/2016"Aclose> (Telose(G ticker-"IBM" (PRICE))) (PRICE))

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!