380 likes | 1.23k Views
Database: Relational Vs Flat File. Databases - Structure. Flat file database, contains only one table Relational database, contains more than one table where relationships exist between the data in the table A flat file database often suffers from inefficient repetition of data.
E N D
Databases - Structure • Flat file database, contains only one table • Relational database, contains more than one table where relationships exist between the data in the table • A flat file database often suffers from inefficient repetition of data. • Normalisation is the process of removing this repetition by crafting relationships between tables.
Databases – Flat File Vs Relational Database + No unnecessary data repetition + Department info easily modified in one operation.
Types of Relationships, connection between data • One-to-one relationship: Eg. Airline’s passenger details: 1 passengers Seats Each passenger has only one seat and each seat can be assigned to only one passenger. A record in one table is connected to only one record in a second table.
Types of Relationships, connection between data • One-to-many relationship: • Eg. customer details & job quotation: The one supplier can provide MANY products, but each product comes from ONE supplier. Also, eg. several workers share single telephone extensions; each extension record is related to several employee’s records.
Types of Relationships, connection between data • many-to-many relationship: • Eg. Student details and subjects tables: students subjects Each student studies many subjects and each subject has many students
Databases – Flat File Vs Relational • School and Student Details • If data was only in one table, with fields of surname, fname, school, address, phone no, fax no, etc. What would be the consequence of a school changing its phone number? • A RDMS with two tables, one with student info and one with school information will avoid this duplication.
Databases – Flat File Vs Relational • Advantages of a relational database: • reduced data redundancy – unnecessary duplication of data • improved data integrity or accuracy of data • able to access the data from separate but related tables or files very quickly and simply • allows easy querying, reporting, etc.