Note: - Probably these questions are too basic for experienced SQL SERVER guys. But from a fresher’s point of view, it can be a difference between getting a job and being jobless.
- Database provides a systematic and organized way of storing, managing and retrieving from a collection of logically related information.
- Secondly, the information has to be persistent, that means even after the application is closed the information should be persisted.
- Finally, it should provide an independent way of accessing data and should not be dependent on the application to access the information.
Ok, let me spend a few more sentences on explaining the third aspect. Below is a simple figure of a text file that has personal detail information. The first column of the information is
Address and finally
Phone Number. This is a simple text file, which was designed by a programmer for a specific application.
It works fine in the boundary of the application. Now, some years down the line a third party application has to be integrated with this file. In order for the third party application to be integrated properly, it has the following options:
- Use the interface of the original application.
- Understand the complete details of how the text file is organized, example the first column is
Address and finally
Phone Number. After analyzing, write a code which can read the file, parse it etc. Hmm, lot of work, right.
That’s what the main difference is between a simple file and a database; database has an independent way (SQL) of accessing information while simple files do not (That answers my twisted question defined above). File meets the storing, managing and retrieving part of a database, but not the independent way of accessing data.
Note: - Many experienced programmers think that the main difference is that file cannot provide multi-user capabilities which a DBMS provides. But if you look at some old COBOL and C programs where files were the only means of storing data, you can see functionalities like locking, multi-user etc. provided very efficiently. So it’s a matter of debate. If some interviewers think of this as a main difference between files and database, accept it… going in to debate means probably losing a job.
(Just a note for fresher’s: Multi-user capabilities mean that at one moment of time more than one user should be able to add, update, view and delete data. All DBMS' provides this as in-built functionalities, but if you are storing information in files, it’s up to the application to write logic to achieve these functionalities).
Asked In: Many Interviews |