Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC-310 Database Systems

Similar presentations


Presentation on theme: "CPSC-310 Database Systems"— Presentation transcript:

1 CPSC-310 Database Systems
Professor Jianer Chen Room 315C HRBB Lecture #4

2 From E/R Diagrams to Relations (Converting E/R diagrams into tables)

3 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
an entity set  a relation (attributes  attributes). E/R diagram Relation Beers name manf Beers(name, manf)

4 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
an entity set  a relation (attributes  attributes). a relationship  a relation with attributes: * keys of the connected entity sets. * attributes of the relationship itself. E/R diagram Drinkers Beers Likes Favorite Married husband wife name addr manf Buddies 1 2 Relations Likes(drinker, beer) Favorite(drinker, beer) Buddies(name1, name2) Married(husband, wife)

5 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations

6 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations OK to combine into one relation if:

7 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations OK to combine into one relation if: * The relation for an entity set E * The relations for many-one relationships where E is the “many.”

8 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations OK to combine into one relation if: * The relation for an entity set E * The relations for many-one relationships where E is the “many.” Example: Drinkers(name, addr) and Favorite(drinker, beer)

9 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations OK to combine into one relation if: * The relation for an entity set E * The relations for many-one relationships where E is the “many.” Example: Drinkers(name, addr) and Favorite(drinker, beer) Drinkers(name, addr) Drinkers name addr Beers manf Favorite Favorite(drinker, beer)

10 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations OK to combine into one relation if: * The relation for an entity set E * The relations for many-one relationships where E is the “many.” Example: Drinkers(name, addr) and Favorite(drinker, beer) combine to make Drinkers1(name, addr, favBeer). Drinkers(name, addr) Drinkers1(name, addr, favBeer) + Favorite(drinker, beer)

11 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Combining Relations OK to combine into one relation if: * The relation for an entity set E * The relations for many-one relationships where E is the “many.” Example: Drinkers(name, addr) and Favorite(drinker, beer) combine to make Drinkers1(name, addr, favBeer). Drinkers(name, addr) Drinkers1(name, addr, favBeer) + Drinkers name addr Beers manf Favorite Drinkers1 name addr favBeer Beers manf Favorite(drinker, beer)

12 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Risk with combining relations in many-many relationships

13 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Risk with combining relations in many-many relationships Combining Drinkers with Likes would be a mistake. It leads to redundancy, as: Drinkers name addr Beers manf Likes

14 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Risk with combining relations in many-many relationships Combining Drinkers with Likes would be a mistake. It leads to redundancy, as: Drinkers name addr Beers manf Likes Drinkers2 name addr beer Beers name manf

15 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Risk with combining relations in many-many relationships Combining Drinkers with Likes would be a mistake. It leads to redundancy, as: Drinkers name addr Beers manf Likes Drinkers2 name addr beer Beers name manf Drinkers2 name addr beer Sally 123 Maple Bud Sally 123 Maple Miller

16 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Risk with combining relations in many-many relationships Combining Drinkers with Likes would be a mistake. It leads to redundancy, as: Drinkers name addr Beers manf Likes Drinkers2 name addr beer Beers name manf Drinkers2 name addr beer Sally 123 Maple Bud Sally 123 Maple Miller Redundancy

17 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets

18 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes.

19 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes).

20 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location

21 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo)

22 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName, hostName2)

23 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName, hostName2) Must be the same

24 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName, hostName2) Must be the same

25 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName)

26 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName) it becomes part of Logins

27 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo) At(loginName, hostName) it becomes part of Logins

28 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Weak Entity Sets Relation for a weak entity set must include attributes for its complete key (including those belonging to other entity sets), as well as its own attributes. A supporting relationship is redundant and yields no relation (unless it has attributes). Example: Logins Hosts At name billTo location Hosts(hostName, location) Logins(loginName, hostName, billTo)

29 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches

30 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches Object-oriented: One relation per subset of subclasses, with all relevant attributes.

31 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them.

32 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass.

33 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass.

34 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. Object-oriented

35 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. Object-oriented Beers name manf bud Anheuser-Busch Ales name manf color Summerbrew Pete’s dark

36 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. Object-oriented Beers name manf bud Anheuser-Busch Ales name manf color Summerbrew Pete’s dark Good for queries like “find the color of ales made by Pete’s.”

37 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. Use nulls

38 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. Use nulls Beers name manf color Bud Anheuser-Busch NULL Summerbrew Pete’s dark

39 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. Use nulls Beers name manf color Bud Anheuser-Busch NULL Summerbrew Pete’s dark Save space unless there are lots of attributes that are usually NULL

40 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. E/R Style

41 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. E/R Style Beers name manf Bud Anheuser-Busch Summerbrew Pete’s Ales name color Summerbrew dark

42 From E/R Diagrams to Relations (Converting E/R diagrams into tables)
Handling Subclasses: Three Approaches manf name Beers isa Ales color Object-oriented: One relation per subset of subclasses, with all relevant attributes. Use nulls: One relation, entities have NULL in attributes that don’t belong to them. E/R style: One relation for each subclass: * Key attribute(s). * Attributes of that subclass. E/R Style Beers name manf Bud Anheuser-Busch Summerbrew Pete’s Ales name color Summerbrew dark Good for queries like “find all beers (including ales) made by Peter’s.”

43 Outline of Course Representing things by tables E-R model (Ch. 4)
Good table structures Functional Dependencies (Ch.3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs ) SQL languages in DDL/DML (Ch. 6) Query processing (Chs ) More on SQL (Chs. 7-9) Transition processing (Chs )

44 Outline of Course Representing things by tables E-R model (Ch. 4)
Good table structures functional dependencies (Ch.3) Basic operations on relations Relational Algebra (Ch. 2) Storage management (Chs ) SQL languages in DDL/DML (Ch. 6) Query processing (Chs ) More on SQL (Chs. 7-9) Transition processing (Chs )

45 Review on Tables (Relations)
name manf Winterbrew Peter’s Bud Lite Anheuser-Busch Beers

46 Review on Tables (Relations)
attributes (column headers) name manf Winterbrew Peter’s Bud Lite Anheuser-Busch tuples (rows) table/relation name Beers

47 Review on Tables (Relations)
attributes (column headers) name manf Winterbrew Peter’s Bud Lite Anheuser-Busch tuples (rows) table/relation name Beers Attributes A determine attribute b: two tuples with the same values in A must have the same value in b.

48 Review on Tables (Relations)
attributes (column headers) name manf Winterbrew Peter’s Bud Lite Anheuser-Busch tuples (rows) table/relation name Beers Attributes A determine attribute b: two tuples with the same values in A must have the same value in b. Superkey: a set of attributes that determines all other attributes.

49 Review on Tables (Relations)
attributes (column headers) name manf Winterbrew Peter’s Bud Lite Anheuser-Busch tuples (rows) table/relation name Beers Attributes A determine attribute b: two tuples with the same values in A must have the same value in b. Superkey: a set of attributes that determines all other attributes. Key: a minimal superkey.

50 Review on Tables (Relations)
attributes (column headers) name manf Winterbrew Peter’s Bud Lite Anheuser-Busch tuples (rows) table/relation name Beers Attributes A determine attribute b: two tuples with the same values in A must have the same value in b. Superkey: a set of attributes that determines all other attributes. Key: a minimal superkey. Every relation has a key

51 What makes a bad table?

52 Likes(drinker, addr, zip, beer, manf)
What makes a bad table? Example: consider the relation Likes(drinker, addr, zip, beer, manf)

53 Likes(drinker, addr, zip, beer, manf)
What makes a bad table? Example: consider the relation Likes(drinker, addr, zip, beer, manf) Record the information that the drinker living in addr with zipcode zip likes the beer made by manf.

54 What makes a bad table? drinker addr zip beer manf Janeway
21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002

55 What makes a bad table? Because name determines addr drinker addr zip
beer manf Janeway 21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 Because name determines addr

56 What makes a bad table? Because name determines addr Because beer
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 Because name determines addr Because beer determines manf

57 What makes a bad table? The redundancy of information will drinker
addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will

58 What makes a bad table? The redundancy of information will
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will Waste space.

59 What makes a bad table? The redundancy of information will
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will Waste space. Cause logic inconsistency

60 What makes a bad table? The redundancy of information will
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will Waste space. Cause logic inconsistency * update anomaly;

61 What makes a bad table? The redundancy of information will
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will Waste space. Cause logic inconsistency * update anomaly;

62 What makes a bad table? The redundancy of information will
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will Waste space. Cause logic inconsistency * update anomaly; * deletion anomaly.

63 What makes a bad table? The redundancy of information will
drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 The redundancy of information will Waste space. Cause logic inconsistency * update anomaly; * deletion anomaly. Lost the information that Spock lives in 32 B Street, Austin

64 What makes a bad table? drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 All these come from some non-superkeys that determine some other attributes.

65 What makes a bad table? drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 All these come from some non-superkeys that determine some other attributes. We should eliminate such functional dependencies.

66 What makes a bad table? drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 All these come from some non-superkeys that determine some other attributes. We should eliminate such functional dependencies. How? → check every non-superkey,

67 What makes a bad table? drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 All these come from some non-superkeys that determine some other attributes. We should eliminate such functional dependencies. How? → check every non-superkey, but How?

68 What makes a bad table? drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 All these come from some non-superkeys that determine some other attributes. We should eliminate such functional dependencies. How? → check every non-superkey, but How? The table itself gives some obvious dependencies

69 What makes a bad table? drinker addr zip beer manf Janeway 21 A street, Austin 78702 Bud A. B. 29 A street, Austin Bud Lite WichedAle Peter’s Spock 32 B street, Houston 77002 All these come from some non-superkeys that determine some other attributes. We should eliminate such functional dependencies. How? → check every non-superkey, but How? The table itself gives some obvious dependencies But there can be non-obvious ones

70 Functional Dependencies
Definition. X → A is an assertion about a relation R that whenever two tuples of R agree on all the attributes of X, then they must also agree on the attribute A.

71 Functional Dependencies
Definition. X → A is an assertion about a relation R that whenever two tuples of R agree on all the attributes of X, then they must also agree on the attribute A. Say “X (functionally) determines A (in R).”

72 Functional Dependencies
Definition. X → A is an assertion about a relation R that whenever two tuples of R agree on all the attributes of X, then they must also agree on the attribute A. Say “X (functionally) determines A (in R).” Convention: …, X, Y, Z represent sets of attributes; A, B, C, … represent single attributes.

73 Functional Dependencies
Definition. X → A is an assertion about a relation R that whenever two tuples of R agree on all the attributes of X, then they must also agree on the attribute A. Say “X (functionally) determines A (in R).” Convention: …, X, Y, Z represent sets of attributes; A, B, C, … represent single attributes. Convention: write ABC instead of {A,B,C}.

74 Functional Dependencies
Definition. X → A is an assertion about a relation R that whenever two tuples of R agree on all the attributes of X, then they must also agree on the attribute A. Say “X (functionally) determines A (in R).” Convention: …, X, Y, Z represent sets of attributes; A, B, C, … represent single attributes. Convention: write ABC instead of {A,B,C}. Our main goal is to find non-superkeys X that determine other attributes

75 Functional Dependencies
No need for FD’s with more than one attribute on right.

76 Functional Dependencies
No need for FD’s with more than one attribute on right. * But sometimes convenient to combine FD’s as a shorthand.

77 Functional Dependencies
No need for FD’s with more than one attribute on right. * But sometimes convenient to combine FD’s as a shorthand. * Example: drinker → addr and drinker → zip are the same as drinker → addr zip

78 Functional Dependencies
No need for FD’s with more than one attribute on right. * But sometimes convenient to combine FD’s as a shorthand. * Example: drinker → addr and drinker → zip are the same as drinker → addr zip > 1 attribute on left may be essential.

79 Functional Dependencies
No need for FD’s with more than one attribute on right. * But sometimes convenient to combine FD’s as a shorthand. * Example: drinker → addr and drinker → zip are the same as drinker → addr zip > 1 attribute on left may be essential. * Example: bar beer → price but NOT bar → price or beer → price

80 Functional Dependencies
Thus, a superkey is a set X of attributes such that X → A for all attributes A in R. A key is a superkey in which no subset makes a superkey.

81 Functional Dependencies
Thus, a superkey is a set X of attributes such that X → A for all attributes A in R. A key is a superkey in which no subset makes a superkey. Example. Likes(drinker, addr, zip, beer, manf)

82 Functional Dependencies
Thus, a superkey is a set X of attributes such that X → A for all attributes A in R. A key is a superkey in which no subset makes a superkey. Example. Likes(drinker, addr, zip, beer, manf) * {drinker, zip, beer, manf} is a superkey.

83 Functional Dependencies
Thus, a superkey is a set X of attributes such that X → A for all attributes A in R. A key is a superkey in which no subset makes a superkey. Example. Likes(drinker, addr, zip, beer, manf) * {drinker, zip, beer, manf} is a superkey. * there are many other superkeys.

84 Functional Dependencies
Thus, a superkey is a set X of attributes such that X → A for all attributes A in R. A key is a superkey in which no subset makes a superkey. Example. Likes(drinker, addr, zip, beer, manf) * {drinker, zip, beer, manf} is a superkey. * there are many other superkeys. * {drinker, beer} is a key (the only key)

85 E/R and Relational Keys
Keys in E/R concern entities. Keys in relations concern tuples.

86 E/R and Relational Keys
Keys in E/R concern entities. Keys in relations concern tuples. Usually, one tuple corresponds to one entity, so the ideas are the same.

87 E/R and Relational Keys
Keys in E/R concern entities. Keys in relations concern tuples. Usually, one tuple corresponds to one entity, so the ideas are the same. But --- in poor relational designs, one entity can become several tuples, so E/R keys and Relational keys are different.

88 Where Do Keys Come From?

89 Where Do Keys Come From? Just assert a key K.
* The only FD’s are K →A for all attributes A.

90 Where Do Keys Come From? Just assert a key K.
* The only FD’s are K →A for all attributes A. Assert FD’s and deduce the keys by systematic exploration.

91 Where Do Keys Come From? Just assert a key K.
* The only FD’s are K →A for all attributes A. Assert FD’s and deduce the keys by systematic exploration. * E/R model gives us FD’s from entity-set keys and from many-one relationships.

92 Where Do Keys Come From? Just assert a key K.
* The only FD’s are K →A for all attributes A. Assert FD’s and deduce the keys by systematic exploration. * E/R model gives us FD’s from entity-set keys and from many-one relationships. FD’s from “physics”.

93 Where Do Keys Come From? Just assert a key K.
* The only FD’s are K →A for all attributes A. Assert FD’s and deduce the keys by systematic exploration. * E/R model gives us FD’s from entity-set keys and from many-one relationships. FD’s from “physics”. * Example: “no two courses can meet in the same room at the same time” tells us: hour room → course.


Download ppt "CPSC-310 Database Systems"

Similar presentations


Ads by Google