Skip to content
doubtly

1 answer

Best answer

Answer: In a file system each application keeps its own files and must handle storage, searching and checking itself, which leads to redundancy and inconsistency; in a database system all data is stored once in an integrated database managed by a DBMS, which gives querying, integrity, security, concurrent access and recovery.

PointFile systemDatabase system (DBMS)
StorageData kept in separate files owned by each applicationData kept in one integrated database (tables) managed by the DBMS
Redundancy and consistencySame data repeated in many files; copies can disagree (inconsistency)Redundancy is controlled, so data stays consistent
Data accessA new program must be written for every new queryAny query can be written in SQL
Data independenceFile format is built into programs; changing it means changing programsPrograms are insulated from storage details (data independence)
IntegrityRules (e.g. marks ≤ 100) are coded inside each programConstraints (primary key, foreign key, CHECK) are declared once and enforced by the DBMS
Concurrent accessSimultaneous updates can overwrite each otherConcurrency control and transactions (ACID) handle many users safely
SecurityOnly file-level permissionsUsers, roles and privileges on tables, columns and views
Backup and recoveryManual; a crash can leave files half-updatedAutomatic recovery to a consistent state using logs
Cost and sizeCheap and simple for small, single-user dataNeeds DBMS software and skilled staff; best for large shared data

Example: student records in a college

  • File system: the office keeps students.txt (roll no, name, address, phone) and the library keeps members.txt with the same student's name and phone again. If a student changes his phone number and only the office file is updated, the library file still has the old number (redundancy leading to inconsistency). To list "students of SE Computer with pending library books" someone must write a new program that reads both files. If two clerks edit the same file at once, one update can be lost.
  • Database system: one college database has tables Student(roll_no, name, phone, branch) and Issue(roll_no, book_id, issue_date). The phone is stored once, so every department sees the updated value. The query is simply
    SELECT s.name FROM Student s JOIN Issue i ON s.roll_no = i.roll_no WHERE s.branch = 'SE Computer';
    A foreign key on Issue.roll_no stops a book being issued to a roll number that does not exist, the DBMS lets office and library staff work at the same time, and the library clerk can be given access only to the columns needed.
Doubtly · 3 May 2023 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.