Question

In: Computer Science

Product(p-id, p-name, weight) Retailer(r-id, r-name, city) Sells(r-id, p-id, price)

 

Product(p-id, p-name, weight)
Retailer(r-id, r-name, city)
Sells(r-id, p-id, price)


r-id is a foreign key referencing Retailer
p-id is a foreign key referencing Product


Give a Relational Algebra expression : (IT IS NOT SQL)


(a) Find the names of the retailers who are selling the products that have a weight greater than 10 kg.
(b) Find the names of the retailers who have never sold a product that has a weight greater than 10 kg.
(c) Get the price of the products that have a weight greater than 10 kg and have been sold by the retailers from Istanbul.
(d) Find the average price of each product that is sold.

Solutions

Expert Solution

These are the queries of relation algebra for the given problems.

where |X| symbol is used to represent the natural join between tables.

Explanation:

In the first what we are doing is we are first joining those rows/tuples which are common to all the tables by using natural join.After joning the tables we are selecting those rows which have weight greater than 10 using Selection operator then after that we are Projecting only the Name column.

In the similiar way we are selecting rows with weight not greater than 10 after joining the tables.

Then in third we are projecting Price column only by selecting rows with weight greater than 10 and place equals to Istanbul .

And in the last query we are first projecting only the Price column then passing in into the aggreagte function i.e AVG.

 


Related Solutions

Consider a firm that produces output that sells in the product market for a price P...
Consider a firm that produces output that sells in the product market for a price P = 1. The firm uses the production technology Y = F(L) = 10 ∗ ln(L), where L is the number of laborers hired in production. The firm takes the hourly wage W as given. Capital is not used in production. 1.1 Suppose the wage rises from W = 1 to W = 2. What is the firm’s elasticity of demand over this range? 1.2...
Oracle - Create a procedure that accepts product ID as a parameter and returns the name...
Oracle - Create a procedure that accepts product ID as a parameter and returns the name of the product from ProductTable table. Add exception handling to catch if product ID is not in the table. Table to use: CREATE TABLE ProductTable(     ProductID INTEGER NOT NULL primary key,     ProductName VARCHAR(50) NOT NULL,     ListPrice NUMBER(10,2),     Category INTEGER NOT NULL ); / INSERT INTO ProductTable VALUES(299,'Chest',99.99,10); INSERT INTO ProductTable VALUES(300,'Wave Cruiser',49.99,11); INSERT INTO ProductTable VALUES(301,'Megaland Play Tent',59.99,11); INSERT INTO...
write a sql statement that retrieves product ID (ProductID) and name (Name) from Production.product table for...
write a sql statement that retrieves product ID (ProductID) and name (Name) from Production.product table for all product whose name includes both the words "silver" and "frame"
Product details are as follows: Product P Q R S Selling price (£/unit) 42.00 57.00 54.60...
Product details are as follows: Product P Q R S Selling price (£/unit) 42.00 57.00 54.60 Material T1 (Kg/unit) 4 6 6 Material T2 (Kg/unit) 4 4.4 3.2 6 Direct labour (hours/unit) 1.2 2.4 3 3.4 Variable production overheads (£/unit) 2.20 2.60 2.20 2.80 Fixed production overheads (£/unit) 3.00 3.20 3.40 2.80 Expected demand for next month (units)         1,900         2,000         1,800 Products P, Q and R are sold to customers, while Product S is a component used...
2) S&P Supply sells only two products, Product S and Product P. Product S Product P...
2) S&P Supply sells only two products, Product S and Product P. Product S Product P Selling price per unit $25 $50 Variable cost per unit $20 $30 Fixed costs $225,000 a) What is the firm’s breakeven sales in dollars, assuming a sales (revenue) mix of 20% Product S and 80% Product P? b). Suppose the firm generated the amount of sales in dollars needed to break even, assuming a sales mix of 20% Product S and 80% Product P....
The net weight (in oz.) of a dry bleach product is to be monitored by  and R  and  and...
The net weight (in oz.) of a dry bleach product is to be monitored by  and R  and  and S  control charts using a sample size of n = 5. Data for 20 preliminary samples are shown below. Subgroup Number X1 X2 X3 X4 X5 1 12 9 13 15 12 2 10 7 16 14 8 3 7 8 10 6 9 4 8 9 15 13 7 5 9 10 7 13 16 6 12 11 10 10 8 7 16 10...
The net weight (in oz.) of a dry bleach product is to be monitored by  and R  and  and...
The net weight (in oz.) of a dry bleach product is to be monitored by  and R  and  and S  control charts using a sample size of n = 5. Data for 20 preliminary samples are shown below. Subgroup Number X1 X2 X3 X4 X5 1 12 9 13 15 12 2 10 7 16 14 8 3 7 8 10 6 9 4 8 9 15 13 7 5 9 10 7 13 16 6 12 11 10 10 8 7 16 10...
Consider a retailer that sells a single type of product and all assumption of the basic...
Consider a retailer that sells a single type of product and all assumption of the basic economic order quantity model are valid. The annual demand is 5000 units. Each order release to the supplier incurs a fixed $50 cost and the annual holding cost is $8 per unit. The store manager has already determined the optimal order quantity for this product. (a) If we choose to use an order quantity of q = 350 units, what would be the percentage...
Waterloo Co. sells product P-14 at a price of $48 a unit. The per-unit cost data...
Waterloo Co. sells product P-14 at a price of $48 a unit. The per-unit cost data are direct materials $15, direct labour $10, and overhead $12 (75% variable). Waterloo Co. has sufficient capacity to accept a special order for 40,000 units, but at a discount of 10% from the regular price. Selling costs associated with this order would be $3 per unit. There are no selling costs on its regular orders. a) Should Waterloo Co. should accept the special order?...
Surfs Up P/L is a national retailer that sells a range of surfing and water sport...
Surfs Up P/L is a national retailer that sells a range of surfing and water sport equipment (surfboards, clothing, etc.) with an annual turnover of $60 million. Surfs Up purchases “Billapro” surfboards for $440 each from Billapong P/L, a large manufacturer of surfboards located at Gold Coast with an annual turnover of around $45 million, this was their only sale for the month. Surfs Up plans to sell the Surfboards at a 200% mark-up to its customers. In October last...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT