Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assume you are given the following statistics: T(Likes), T(Drinkers), S(Likes), S(Drinkers), V(Likes, x) for all attributes x in Likes, V(Drinkers, y) for all attributes y
Assume you are given the following statistics: T(Likes), T(Drinkers), S(Likes), S(Drinkers), V(Likes, x) for all attributes x in Likes, V(Drinkers, y) for all attributes y in Drinkers. For your beers database: 1. As a function of the above statistics, compute the following. a) To beer='Bud' Likes) b) To beer='Bud' Likes X Drinkers) on attribute drinker c) To beer='Bud Likes |X| Drinkers) on attribute drinker (note: the attribute is named drinker' in one relation and 'name' in the other relation. You should make sure to rename it in order to run the natural join. You may find the postgres ALTER TABLE RENAME... command useful here). 2. Then connect to your database beersdb and find the numeric values of T(Likes), T(Drinkers), S(Likes), S(Drinkers), V(Likes, x) for all attributes x in Likes, V(Drinkers, y) for all attributes y in Drinkers. Show any queries you may use to find the above numbers. 3. Plug these numbers in your computations of 1. and report the numeric values of the cardinality results that you are finding for each of the three queries. 4. Verify your computations of 3. by running the queries. In particular. a) Run all three queries and show the results of each query. b) Report the cardinality of each of the query results. Assume you are given the following statistics: T(Likes), T(Drinkers), S(Likes), S(Drinkers), V(Likes, x) for all attributes x in Likes, V(Drinkers, y) for all attributes y in Drinkers. For your beers database: 1. As a function of the above statistics, compute the following. a) To beer='Bud' Likes) b) To beer='Bud' Likes X Drinkers) on attribute drinker c) To beer='Bud Likes |X| Drinkers) on attribute drinker (note: the attribute is named drinker' in one relation and 'name' in the other relation. You should make sure to rename it in order to run the natural join. You may find the postgres ALTER TABLE RENAME... command useful here). 2. Then connect to your database beersdb and find the numeric values of T(Likes), T(Drinkers), S(Likes), S(Drinkers), V(Likes, x) for all attributes x in Likes, V(Drinkers, y) for all attributes y in Drinkers. Show any queries you may use to find the above numbers. 3. Plug these numbers in your computations of 1. and report the numeric values of the cardinality results that you are finding for each of the three queries. 4. Verify your computations of 3. by running the queries. In particular. a) Run all three queries and show the results of each query. b) Report the cardinality of each of the query results
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started