Relational Design
1 / 34
Relational Design 1 / 34 Relational Design Basic design - - PowerPoint PPT Presentation
Relational Design 1 / 34 Relational Design Basic design approaches. What makes a good design better than a bad design? How do we tell we have a "good" design? How to we go about creating a good design? 2 / 34 Basic
1 / 34
◮ Basic design approaches. ◮ What makes a good design better than a bad design? ◮ How do we tell we have a "good" design? ◮ How to we go about creating a good design?
2 / 34
◮ Bottom-up, a.k.a. synthethis
◮ Start with individual attributes and large set of binary relationships
◮ Unpopular
◮ Top-down, a.k.a. analysis
◮ Start with groupings of attributes, e.g., a schema derived from
◮ Decompose until design properties are met 3 / 34
4 / 34
◮ Attributes of employees and attributes of departments ◮ What does a single tuple represent?
◮ Each EMPT tuple represents a single employee ◮ Each DEPT tuple represents a single department
5 / 34
◮ wastes storage space, and ◮ leads to data manipulation anomalies.
6 / 34
7 / 34
8 / 34
9 / 34
10 / 34
◮ Nulls don’t have definite meaning - could be absent, N/A, false ◮ Aren’t used in joins ◮ Aren’t counted in aggregate functions ◮ Waste space
11 / 34
12 / 34
13 / 34
14 / 34
◮ Join on Dno tells us an employee’s department ◮ Acheived by normalization based on functional dependency theory -
15 / 34
16 / 34
17 / 34
18 / 34
◮ A → A ◮ AB → A ◮ AB → B
19 / 34
◮ minimizing redundancy, and ◮ minimizing insertion, deletion, and update anomalies
20 / 34
21 / 34
22 / 34
◮ An attribute is prime if it is part of a candidate key, ◮ otherwise it is nonprime.
23 / 34
◮ FD1: Property_id → County_name, Lot#, Area, Price, Tax_rate ◮ FD2: County_name, Lot# → Property_id, Area, Price, Tax_rate ◮ FD3: County_name → Tax_rate ◮ FD4: Area → Price
24 / 34
◮ FD1: Property_id → County_name, Lot#, Area, Price, Tax_rate ◮ FD2: County_name, Lot# → Property_id, Area, Price, Tax_rate ◮ FD4: Area → Price
◮ FD3: County_name → Tax_rate
25 / 34
◮ (a) X is a superkey of R, or ◮ (b) A is a prime attribute of R.
◮ FD1: Property_id → County_name, Lot#, Area, Price, Tax_rate ◮ FD2: County_name, Lot# → Property_id, Area, Price, Tax_rate ◮ FD4: Area → Price
26 / 34
◮ FD1: Property_id → County_name, Lot#, Area, Price, Tax_rate ◮ FD2: County_name, Lot# → Property_id, Area, Price, Tax_rate
◮ FD4: Area → Price
27 / 34
◮ FD1: Property_id → County_name, Lot#, Area, Price, Tax_rate ◮ FD2: County_name, Lot# → Property_id, Area, Price, Tax_rate ◮ FD3: County_name → Tax_rate ◮ FD4: Area → Price
28 / 34
◮ FD1: Property_id → County_name, Lot#, Area ◮ FD2: County_name, Lot# → Property_id, Area
◮ FD4: Area → Price
◮ FD3: County_name → Tax_rate
29 / 34
◮ A nonprime attribute determines another nonprime attribute, giving
◮ Some subset of a key determines a nonprime attribute, giving rise to
30 / 34
◮ AB → C ◮ C → B
31 / 34
◮ FD1: Property_id → County_name, Lot#, Area ◮ FD2: County_name, Lot# → Property_id, Area ◮ FD5: Area → County_name
32 / 34
◮ FD1: Property_id → County_name, Lot#, Area
◮ FD5: Area → County_name
33 / 34
◮ FD1: {Student, Course} → Instructor ◮ FD2: Instructor → Course.
34 / 34