Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions