Download presentation
Presentation is loading. Please wait.
Published byOscar Wilcox Modified over 9 years ago
1
28-Jan-16db.ppt Relational Database Concepts
2
28-Jan-16db.ppt relational database example contain tables tables contain records (rows) records are broken into columns (fields) PK_ID Quote FK_Sources 1I don’t like that man; I must get to know him better. 4 2I wish I had an answer to that because I'm tired of answering that question. 1 3Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. 3 4People are just as happy as they make up their minds to be. 4
3
28-Jan-16db.ppt first design for the MyQuotes database PK_ID QuoteBody QuoteSource 1I don’t like that man; I must get to know him better. Abraham Lincoln 2I wish I had an answer to that because I'm tired of answering that question. Yogi Berra 3Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. William Penn 4People are just as happy as they make up their minds to be. Abe Lincoln Quotes table: Are records 1 and 4 from the same source?
4
28-Jan-16db.ppt a better design for the MyQuotes database PK_ID Quote FK_Sources 1I don’t like that man; I must get to know him better. 4 2I wish I had an answer to that because I'm tired of answering that question. 1 3Right is right, even if everyone is against it, and wrong is wrong, even if everyone is for it. 3 4People are just as happy as they make up their minds to be. 4 PK_SourceID Source 1Yogi Berra 2Mark Twain 3William Penn 4Abraham Lincoln Quotes1 table:Sources1 table: SELECT Quotes1.QuoteBody, Quotes1.FK_SourceID, Sources1.PK_SourceID, Sources1.SourceBody FROM Quotes1, Sources1 WHERE Quotes1.FK_SourceID=Sources1.PK_SourceID
5
28-Jan-16db.ppt “inner join” SQL statement SELECT Quotes1.QuoteBody, Quotes1.FK_SourceID, Sources1.PK_SourceID, Sources1.SourceBody FROM Quotes1, Sources1 WHERE Quotes1.FK_SourceID=Sources1.PK_SourceID theAnswer = myResultSet.getString(1) + " " + myResultSet.getString(4); “join” because it gets data from two different tables “inner” because each table only returns matching records
6
28-Jan-16db.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
7
28-Jan-16db.ppt Relational Database Concepts Relationships Contraints Triggers Stored procedures Tables Rows (Records) Columns (Fields) Views Indexes Clustered indexes Non-clustered indexes Keys Primary keys Composite keys Foreign keys Locking optimistic pessimistic Isolation Levels (for transactions) gets complicated!
8
28-Jan-16db.ppt the end of this PowerPoint file Hooray!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.