Relational Database Concepts db ppt relational database example
Relational Database Concepts db. ppt
relational database example • contain tables • tables contain records (rows) • records are broken into columns (fields) PK_ID Quote FK_Sources 1 I don’t like that man; I must get to know him better. 4 2 I wish I had an answer to that because I'm tired of answering that question. 1 3 Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. 3 4 People are just as happy as they make up their minds to be. 4 db. ppt
first design for the My. Quotes database Quotes table: PK_ID Quote. Body Quote. Source 1 I don’t like that man; I must get to know him better. Abraham Lincoln 2 I wish I had an answer to that because I'm tired of answering that question. Yogi Berra 3 Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. William Penn 4 People are just as happy as they make up their minds to be. Abe Lincoln db. ppt • Are records 1 and 4 from the same source?
a better design for the My. Quotes database Quotes 1 table: PK_ID Quote FK_Sources 1 I don’t like that man; I must get to know him better. 4 2 I wish I had an answer to that because I'm tired of answering that question. 1 3 Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. 3 4 People are just as happy as they make up their minds to be. 4 Sources 1 table: PK_Source. ID Source 1 Yogi Berra 2 Mark Twain 3 William Penn 4 Abraham Lincoln SELECT Quotes 1. Quote. Body, Quotes 1. FK_Source. ID, Sources 1. PK_Source. ID, Sources 1. Source. Body FROM Quotes 1, Sources 1 WHERE Quotes 1. FK_Source. ID=Sources 1. PK_Source. ID db. ppt
“inner join” SQL statement SELECT Quotes 1. Quote. Body, Quotes 1. FK_Source. ID, Sources 1. PK_Source. ID, Sources 1. Source. Body FROM Quotes 1, Sources 1 WHERE Quotes 1. FK_Source. ID=Sources 1. PK_Source. ID the. Answer = my. Result. Set. get. String(1) + " " + my. Result. Set. get. String(4); “join” because it gets data from two different tables “inner” because each table only returns matching records db. ppt
tables represent “relationships” • one to one relationship (1 table) • a table of Persons may directly contain the social security number • one to many relationship (2 tables) • a table of Sources • a table of Quotes • each Quotes record points to one Sources record • many to many relationship (3 tables) • a table of Persons • a table of Skills • a table of Person-Skills • for each skill that a person has, there is a record here • for each person that has a skill, there is a record here db. ppt
Relational Database Concepts • • Relationships Contraints Triggers Stored procedures • Tables • Views • Indexes • Keys • • Rows (Records) Columns (Fields) Clustered indexes Non-clustered indexes • Primary keys • Foreign keys • Composite keys • Locking • Isolation Levels (for transactions) • • • optimistic pessimistic gets complicated! db. ppt
the end of this Power. Point file Hooray! db. ppt
- Slides: 8