Database Management System (DBMS)
Introduction
Data, database and DBMS
Data are raw facts, plain figures, characters or symbols that on their own carry little meaning, for example the values 1, Rubina, 2081-04-05 or 5.4. When data are processed and arranged so that they help us take decisions, they become information.
A database is a collection of interrelated data about the objects or entities of an organization, stored together in an organized (usually tabular) form so that it can be shared and retrieved easily. The data are interrelated: a student's marks relate to that student's record, which relates to the class they belong to.
A Database Management System (DBMS) is the software that defines, stores, manipulates and manages a database. It sits between the user (or the application program) and the physical data files, and it lets us create the structure of the data, insert and update records, retrieve exactly the records we want, and control who may do what. Popular examples are Oracle, MySQL, Microsoft SQL Server, PostgreSQL and Microsoft Access.
Field, record, table and object
The relational way of organizing data, which is what NEB studies, uses a few basic terms:
- A field (or attribute) is a single item of data, one column of a table, such as
Name or Roll_No.
- A record (or tuple) is one complete set of related fields, one row of the table, describing one entity such as a single student.
- A table (or relation) is a collection of records of the same kind arranged as rows and columns.
- An object is any real world thing (a student, a book, an account) that the database keeps data about; each object usually becomes a table.
Keys
A key is a field, or a group of fields, used to identify records uniquely and to link tables together.
- Primary key: an attribute (or set of attributes) whose value uniquely identifies each record in a table, and which can never be duplicated or left null. A student's registration number is a natural primary key.
- Candidate key: any attribute or combination of attributes that is capable of acting as a primary key, that is, of identifying rows uniquely. A table may have several candidate keys; the designer chooses one of them to be the primary key.
- Alternate key: a candidate key that was not chosen as the primary key.
- Foreign key: an attribute in one table whose value refers to the primary key of another table. Foreign keys are what create the relationship between two tables and they enforce referential integrity, the rule that you cannot refer to a record that does not exist.