Which of the following SQL statements is equivalent to the relational algebra query

10.Which SQL statement is equivalent to the following relational algebra expression?π Deliveriesa.SELECT ProductId, DeliveryDate FROM Deliveries;b.SELECT * FROM Deliveries;c.SELECT ProductId FROM Deliveries WHERE DeliveryDate = GETDATE();d.SELECT * FROM Deliveries WHERE ProductId = @ProductId;

11.The RENAME operation can only be used to rename relations/tables.

Get answer to your question and much more

12.The RENAME operation is often used together with the relation assignment operator <--.

Get answer to your question and much more

13.The __________ operation includes all rows from both relations with duplications removed

Get answer to your question and much more

14.Which SQL statement is equivalent of the following relational algebra expression?OrderByEmployee5 <-- σOrdersOrderAfter04012017 <--σ ‘20170401’>OrdersResult <-- OrderByEmployee5 UOrderAfter04012017;a.SELECT * FROM Ordersb.SELECT OrderId FROM Orders UNION SELECT OrderDate FROM Orders;c.SELECT * FROM Orders WHERE EmployId = 5 UNION SELECT * FROM Orders WHEREOrderDate > ‘20170401’;d.There’s no equivalent in SQL

15.The __________ operation keeps only the common rows between two relations

Get answer to your question and much more

16.The ________ operation keeps only the rows that appear in the first realtion and not in thesecond relation

Get answer to your question and much more

17.Which of the following relational algebra equations is true?

Get answer to your question and much more

18.Suppose relation R1 has a1 attributes and r1 rows and another relation, R2, has a2 attributes andr2 rows.The result of using _________ onR1 and R2 is a new relation that has a1+a2 number

I have the following SQL query:

SELECT foo.a, bar.b, baz.c FROM foo
INNER JOIN bar ON bar.id = foo.bar_id 
INNER JOIN baz ON baz.id = foo.baz_id 
WHERE foo.z = 50; 

I want to know if this is equivalent to this relational algebra statement.

π foo.a, bar.b, baz.c (foo) ⋈ bar.id = foo.bar_id (bar) ⋈ baz.id = foo.baz_id (baz) σ foo.z = 50

asked Nov 23, 2016 at 15:43

Which of the following SQL statements is equivalent to the relational algebra query

4

π foo.a, bar.b, baz.c (foo) ⋈ bar.id = foo.bar_id (bar) ⋈ baz.id = foo.baz_id (baz) σ foo.z = 50

This algebra expression is not written according to any common version of relational algebra. So we can't say the SQL is equivalent. It seems to be what you have produced rather than what you were given.

Typically we write:

π attributes ( relation )
σ condition ( relation )

and the algebra expression should be nesting them:

π attributes ( σ condition ( relation ) )

What conditions you are allowed to write and whether you can use dots with attribute names in any of your operator calls depends on how your algebra is defined. Using dots requires having names accompany relation values passed to operators.

Your question cannot be answered fully until you give a reference to or description of the algebra you are supposed to use.

It seems you might think that all you have to do is replace SELECT by π, JOIN by ⋈ and WHERE by σ. That is wrong.

answered Nov 23, 2016 at 23:10

philipxyphilipxy

14.6k6 gold badges34 silver badges80 bronze badges

Yes, it's (your SQL Query) a representation for your relational statement.

answered Nov 23, 2016 at 15:57

1

What is the equivalent relational algebra expression for the given SQL query?

These two queries are equivalent to a SELECTION operation in relational algebra with a JOIN condition or PROJECTION operation with a JOIN condition. The query "SELECT * FROM R, S WHERE R.B = S.B;" is equivalent to "σR.B = S.B(R X S)".

What is the equivalent relational algebra?

Two relational-algebra expressions are equivalent if both the expressions produce the same set of tuples on each legal database instance. A legal database instance refers to that database system which satisfies all the integrity constraints specified in the database schema.

What is relational algebra SQL?

Relational algebra in DBMS is a procedural query language. Queries in relational algebra are performed using operators. Relational Algebra is the fundamental block for modern language SQL and modern Database Management Systems such as Oracle Database, Mircosoft SQL Server, IBM Db2, etc.

What are the relational algebra operations supported in SQL?

Five basic operations in relational algebra: Selection, Projection, Cartesian product, Union, and Set Difference. These perform most of the data retrieval operations needed.