120 likes | 502 Views
Relational Database Concepts. relational database example. contain tables tables contain records (rows) records are broken into columns (fields). first design for the MyQuotes database. Are records 1 and 4 from the same source?. Quotes table:. a better design for the MyQuotes database.
E N D
Relational Database Concepts db.ppt
relational database example • contain tables • tables contain records (rows) • records are broken into columns (fields) db.ppt
first design for the MyQuotes database • Are records 1 and 4 from the same source? Quotes table: db.ppt
a better design for the MyQuotes database 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 db.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 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 • 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! db.ppt
the end of this PowerPoint file Hooray! db.ppt