Download Understanding Data Files, Fields, and Keys in Databases: Concepts & Organization and more Slides Fundamentals of E-Commerce in PDF only on Docsity! Databases Docsity.com Lecture Objectives • Database Concepts • Data Organization in databases • Key Field • Main activities in Database Maintenance – Defining data – Creating data – Manipulating data • Database Usage Docsity.com Data Organization Example • In a University database A L I Field: Name Record for Ali File: Student Field: ID 9 8 … Field: Score 7 0 Record for Rasheed Record for … File: Course File: Faculty University Database Docsity.com A Database Example STUDENT Name StudentName Class Major Mohammad 17 1 CS Idrees 8 2 CS Faisal 9 1 MATH Mujtaba 10 2 MIS COURSE FILE CourseName CourseNumber CreditHours Department Intro to Computer Sc. CS101 4 CS Data Structures CS330 4 CS Dicrete Mathematics MATH241 3 MATH Database CS330 3 CS SECTION SectionIdentifier CourseNumber Semester Year Instructor 1 MATH241 Fall 98 King 2 MATH241 Fall 98 Anderson 1 CS101 Spring 99 Knuth Docsity.com ….Database Concepts • Key Field – Searching a particular record uniquely in a data file requires at least one field unique in value for all records – Example, in STUDENT file StudentNumber is such a field – Common example of key values (in daily life databases) • Social Security Number • Driver’s License • Student ID Numbers Docsity.com Database Implementation Approaches • Flat File Approach – Every data file is tried to be rich in all the relevant details – Every data file is used on a localized basis (e.g. one file for each department). – This makes every file independent of the other files in the database – Benefit: Data Reporting is easily done on each file independently – Disadvantage: Data inconsistencies may result due to data redundancies (duplications) Docsity.com A Flat File Database A Student Grade Database •All the information needed is placed in one single data file •For example, a spreadsheet containing a single student grade file •No need to refer to any other file for data reporting Redundant data values • In GRADE_REPORT: •Student’s personal information includes: StudentNumber, StudentName, Class, Major •Whenever a grade record for a student is inserted in the file, his personal information is repeated. GRADE_REPORT StudentID Name Class Major CourseCode SectionCode Grade 17 Smith 1 CS MATH2410 1 B 17 Smith 1 CS CS1310 1 C 8 Brown 2 COE MATH2410 2 A 8 Brown 2 COE CS1310 1 A 8 Brown 2 COE CS3320 1 B 8 Brown 2 COE CS3380 1 A Docsity.com .. A Student Grade Database • Possible Data Updation Anomalies (abnormality) – When adding a grade for an already existing student, his personal information needs to be consistent with the existing ones (Insertion Anomaly) – If all grade records for a specific student are deleted, other details for that student will also be lost (Deletion Anomaly) – If any student’s number is modified, this needs a change in all other grade records of the same student (Modification Anomaly) GRADE_REPORT StudentID Name Class Major CourseCode SectionCode Grade 17 Smith 1 CS MATH2410 1 B 17 Smith 1 CS CS1310 1 C 8 Brown 2 3 COE MATH2410 2 A 8 Brown 2 3 COE CS1310 1 A 8 Brown 2 3 COE CS3320 1 B 8 Brown 2 COE CS3380 1 A Docsity.com