Computer Science · Ch 8 — Database Concepts
File System
File System
A file is simply a container that stores data on a computer's storage device. The data inside a file can be anything — text, a computer program, comma separated values (CSV), pictures, audio, video, or a web page. Files stored on a computer can be accessed directly, and you can search them for specific data.
However, when a software program needs to access data from a file — for example, to display a monthly attendance report on a school website — you have to write a computer program to read that file. This is where the limitations of a file system begin to show.
Consider a school that needs to store data about students and their attendance. You would likely keep this data in two separate files. The first file, called STUDENT, contains six columns of information about each student:
- RollNumber — the roll number of the student
- SName — the name of the student
- SDateofBirth — the student's date of birth
- GName — the name of the student's guardian
- GPhone — the phone number of the guardian
- GAddress — the address of the guardian
Here is what the STUDENT file might look like:
The second file, called ATTENDANCE, stores the daily attendance records. It has four columns:
- AttendanceDate — the date for which attendance was marked
- RollNumber — the roll number of the student
- SName — the name of the student
- AttendanceStatus — marked as P (present) or A (absent)
Here is a sample of the ATTENDANCE file: …
| RollNumber | SName | SDateofBirth | GName | GPhone | GAddress |
|---|---|---|---|---|---|
| 1 | Atharv Ahuja | 2003-05-15 | Amit Ahuja | 5711492685 | G-35, Ashok Vihar, Delhi |
| 2 | Daizy Bhutia | 2002-02-28 | Baichung Bhutia | 7110047139 | Flat no. 5, Darjeeling Appt., Shimla |
| 3 | Taleem Shah | 2002-02-28 | Himanshu Shah | 9818184855 | 26/77, West Patel Nagar, Ahmedabad |
| 4 | John Dsouza | 2003-08-18 | Danny Dsouza | S -13, Ashok Village, Daman |
| AttendanceDate | RollNumber | SName | AttendanceStatus |
|---|---|---|---|
| 2018-09-01 | 1 | Atharv Ahuja | P |
| 2018-09-01 | 2 | Daizy Bhutia | P |
| 2018-09-01 | 3 | Taleem Shah | A |
| 2018-09-01 | 4 | John Dsouza | P |
| 2018-09-01 | 5 | Ali Shah | A |
| 2018-09-01 | 6 | Manika P. | P |
| 2018-09-02 | 1 | Atharv Ahuja | P |
| 2018-09-02 | 2 | Daizy Bhutia | P |
| 2018-09-02 | 3 | Taleem Shah | A |