A duplicate eliminating projection

Assignment Help PL-SQL Programming
Reference no: EM13500789

Consider the following SQL query over tables R(A), S(A), and T (A). Note that "Select Distinct" in SQL represents a duplicate-eliminating projection.

Select Distinct R.A

From R, S, T

Where R.A = S.A and R.A = T.A

If we have a table with R(A, B) tuples {{1, a}, {1, b}, {2, c}, {3, d}, {4, e}, {4, f }}, then a duplicate-preserving projection on R.A will return {1, 1, 2, 3, 4, 4}, while a duplicate-eliminating projection on R.A will return {1, 2, 3, 4}.

Figures 1(a)-(e) show five logical plans. The logical operator π in Figure 1 represents a duplicate-eliminating projection. For example, πR.A represents a duplicate-eliminating projection of attribute R.A. On the other hand, the logical operator τ represents a duplicate-preserving projection. The logical operator ?? represents a natural join. Assume that, in the general case, R, S, and T can contain duplicate tuples.

1. Is the logical plan in Figure 1(a) equivalent to the logical plan in Figure 1(b)? (Equivalent means that they produce the same query result.) If not, what is the minimal set of properties on the tables such that these plans are equivalent?

2. Is the logical plan in Figure 1(a) equivalent to the logical plan in Figure 1(c)? If not, what is the minimal set of properties on the tables such that these plans are equivalent?

3. Is the logical plan in Figure 1(a) equivalent to the logical plan in Figure 1(d)? If not, what is the minimal set of properties on the tables such that these plans are equivalent?

4. Is the logical plan in Figure 1(a) equivalent to the logical plan in Figure 1(e)? If not, what is the minimal set of properties on the tables such that these plans are equivalent?



1

τR.A

π R.A π R.A


T(A)
T(A) R(A) π R.A S(A)


R(A) S(A) T(A) S(A)
R(A)

(a) (b) (c)
τR.A τR.A


π R.A π R.A π
T(A) T.A





T(A)


R(A) S(A) R(A) S(A)

(d) (e)

Figure 1: Logical plans

Reference no: EM13500789

Questions Cloud

Compute the total asset value : For this project assume that an organization has five total servers. One server has a TCO of $25,000, two servers have a TCO of $37,000 and the remaining two servers have a TCO of $42,000. The servers are not used by internal employees but are ..
Would you advise switching to this alternative plan : All of the costs ofgoods sold are variable, 50 pereent ofthe marketing and distribution costs are variable, and 40 percent ofthe administration costs are variable.
Explain why the yield on a convertible bond is lower than : General Electric has just issued a callable 10-year, 6% coupon bond with annual coupon payments. The bond can be called at par in one year or anytime thereafter on a coupon payment date. It has a price of $102. What is the bond’s yield to maturity an..
Explain the average speed of the sprinter in kilometers : A sprinter set a high school record in track and field, running 200.0 m in 21.6 s. What is the average speed of the sprinter in kilometers per hour
A duplicate eliminating projection : Consider the following SQL query over tables R(A), S(A), and T (A). Note that "Select Distinct" in SQL represents a duplicate-eliminating projection.
Explain the mass concentration of oxygen in the mixture : Suppose you have made 1L worth of a mixture of methanol and water, by mixing 3 parts of methanol and 2 parts of water by mass. Assume for simplicity that the volume of the mixture is exactly equal to the sum of the volumes of the ingredients (whic..
Attributes and behaviors : Write a Class called Course containing the following attributes and behaviors
Determine the eost of goods available for sale : Determine the ending inventory and the cost of goods sold under each of the cost flow methods of FIFO, LIFO, and weighted average cost.
Describe the kinds of securities the u.s. government uses : On January 15, 2020, the U.S. Treasury issued a 10-year inflation-indexed note with a coupon of 6%. On the date of issue, the CPI was 400. By January 15, 2030, the CPI had decreased to 300. What principal and coupon payment was made on January 15, 20..

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Write the queries in sql

Write your queries so that the final answers will never include duplicates, but add the keyword DISTINCT only in cases where duplicates would otherwise be produced.

  Business transaction that involves multiple tables

Write a business transaction that involves multiple tables and implement it using PL/SQL. Use at least one Function or Procedure in your code. The transaction may retrieve data from the database and display the result, or it may insert/update data in..

  Execute queries to confirm that the basket order status

Execute queries to confirm that the basket order status and product stock levels have been appropriately modified by the trigger.

  Sql statement which select names and owners of great danes

Write SQL statement which would select each of the following: names and owners of all Great Danes and all attributes of poodles whose balance is no greater than $50.

  How does the order of joins in an sql statement

How does the order of joins in an SQL statement affect the performance of the join and what can the DBA do to determine the preferred order of joins for an SQL statement that includes the join of at least three tables?

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Compare and contrast the three phases of database design

Write an SQL select statement to list all double or family rooms with a price less than $255 per night in ascending order of price.

  Write sql statement to display first-last name of students

Write a SQL statement to display the First and Last name of students who have the Status greater than 1 and less than 10. Use BETWEEN.

  Write command to list all the employees in year

Write the command to list all the employees hired in 2003 and 2004. Sort the rows by the hire_date column in descending order.

  Write functions to perform the following tasks

Write a function, called ‘binarySearch', implements a binary search. This function should take three parameters.

  Write sql statement to create stored procedure

Write SQL statement which creates stored procedure with one int input parameter. The stored procedure selects the supplierId field and the total of all Count field values for each group of supplierId's from the Part table.

  Display the output of the sql statement

Write a procedure that takes a car registration and returns the most recent date of rental and the maximum rental period for that car.  The procedure had the following formal parameters

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd