Deprecated: Implicit conversion from float-string "1522257944.631" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1522257944.631" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1522257944.631" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1522257944.631" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1522257944.631" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1532850803.078" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1532850803.078" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1532850803.078" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1532850803.078" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1532850803.078" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1532852593.572" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1532852593.572" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1532852593.572" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1532852593.572" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1532852593.572" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1532854879.723" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1532854879.723" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1532854879.723" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1532854879.723" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1532854879.723" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1538893902.742" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1538893902.742" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1538893902.742" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1538893902.742" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1538893902.742" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1539201659.379" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1539201659.379" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1539201659.379" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1539201659.379" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1539201659.379" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1633273910.656" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1633273910.656" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1633273910.656" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1633273910.656" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1633273910.656" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594

Deprecated: Implicit conversion from float-string "1566220885.291" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 796

Deprecated: Implicit conversion from float-string "1566220885.291" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 801

Deprecated: Implicit conversion from float-string "1566220885.291" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 802

Deprecated: Implicit conversion from float-string "1566220885.291" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 803

Deprecated: Implicit conversion from float-string "1566220885.291" to int loses precision in /var/www/html/qadb/qa-include/app/format.php on line 594
Databases: GATE CSE 2003 | Question: 30
retagged by
8,914 views
42 votes
42 votes

Consider the following SQL query

Select distinct $a_1, a_2, …, a_n$

from $r_1, r_2, …, r_m$

where P

For an arbitrary predicate P, this query is equivalent to which of the following relational algebra expressions?

  1. $\Pi_{a_1, a_2, … a_n}  \sigma_p \left(r_1 \times r_2 \times \dots \times r_m\right)$

  2. $\Pi_{a_1, a_2, … a_n}  \sigma_p \left(r_1 \bowtie r_2 \bowtie \dots \bowtie r_m \right)$

  3. $\Pi_{a_1, a_2, … a_n}  \sigma_p \left(r_1 \cup r_2 \cup \dots \cup r_m \right)$

  4. $\Pi_{a_1, a_2, … a_n}  \sigma_p \left(r_1 \cap r_2 \cap \dots \cap r_m \right)$

retagged by

4 Answers

Best answer
49 votes
49 votes
select distinct in SQL is equivalent to project and by default relation 1, relation 2 in SQL corresponds to cross-product. So, option A.
selected by
13 votes
13 votes
Join intersection union might give lesser num of tuples cross gives all ,A option.
6 votes
6 votes
A. SQL form the cartesian product of the relation named in the form clause, perform a relational algebra selection using the where clause predicate and then projects the result onto the attributes of select clause.
3 votes
3 votes

SELECT DISTINCT In SQL  -  Projection (Π) in Relational Algebra

FROM in SQL - Cartesian Product (×) in Relational Algebra

WHERE in SQL - SELECTION(σ) in Relational Algebra

So, the query will be equivalent to 

Πₐ₁,ₐ₂,…ₐₙσₚ₍ᵣ₁×ᵣ₂×⋯×ᵣₘ₎

 

edited by
Answer:

Related questions

11.3k
views
6 answers
46 votes
Kathleen asked Sep 17, 2014
11,273 views
Consider three data items $D1, D2,$ and $D3,$ and the following execution schedule of transactions $T1, T2,$ and $T3.$ In the diagram, $R(D)$ and $W(D)$ denote the action...
14.8k
views
3 answers
42 votes
Kathleen asked Sep 17, 2014
14,814 views
Consider the following functional dependencies in a database.$$\begin{array}{|l|l|}\hline \text{Date_of_Birth } \to \text{Age} & \text{Age } \to \text{Eligibility} \\\hli...
10.0k
views
7 answers
30 votes
Kathleen asked Sep 17, 2014
10,010 views
Consider the following $2-3-4$ tree (i.e., B-tree with a minimum degree of two) in which each data item is a letter. The usual alphabetical ordering of letters is used in...
15.3k
views
3 answers
46 votes
Kathleen asked Sep 17, 2014
15,286 views
Consider the set of relations shown below and the SQL query that follows.Students: (Roll_number, Name, Date_of_birth)Courses: (Course_number, Course_name, Instructor)Grad...