90 likes | 203 Views
Database Fundamentals. Why use a database?. Putting all data into a single file simply doesn’t work because- Redundancy Insertion/deletion/update problems when all data is in a single file Data integrity (data can’t be trusted) . Why must a database be “normalized?” .
E N D
Why use a database? Putting all data into a single file simply doesn’t work because- • Redundancy • Insertion/deletion/update problems when all data is in a single file • Data integrity (data can’t be trusted)
Why must a database be “normalized?” Normalization is just a fancy word for “putting the data into tables that make sense and will not cause errors.”
What is a “data model” A data model is like an architectural blueprint for a database. It shows- • Table relationships • The numerical relationships between tables (called “cardinality”) • Table relationship rules (referential Integrity, cascading updates/deletes, etc.)
Why Cardinality? Cardinality is the numerical relationship between tables. It is need to show how the occurrence of one record in a table relates to other tables.
An Example of a 1 to Many relationship For example, a customer order may have many orders but a particular order can only refer to 1 customer. An order can only be associated with one customer but a particular customer can have many orders. This is shown as 1:M
Good News Most cardinalities (the numerical relationship between tables) in a database are- 1:M (one to many)
Any more Cardinalities? The one to one cardinality (1:1) is rarely needed but it is sometimes used for the following reasons- • Security of specific data • Performance (speed of database access)
How important is a data model? Very A poorly constructed data model will likely result in bad data and unintended actions occurring in the database.