Basic Fundamentals of Databases


What is a database?

  1. A database is any collection of related data.
  2. A database is a persistent, logically coherent
    collection of inherently meaningful data, relevant
    to some aspects of the real world.

persistent, means that it stores data beyond the power down of the desktop, server or device.
logically coherent, means that data is logically connected, understood and changes with interdependencies
inherently meaningful, means that at the end of the day, the data will be useful and understandable with the context under which we are building the “coherancy” of the data

What is DBMS?

A database management system (DBMS) is a collection of programs that enables users to create and maintain a database.

When we program on a database, the DBMS tools help us by hiding the internal storage and internal schema. Thankfully we only need to understand the external schema and the external views.
The external schema is popularly known as the “Schema”. In our discussions outside the context of this tutorial, we only refer to schema, and never the “internal/external” schema.

What is Table?

A table is collection of data that have the same properties. A table is a set of records. A record/row in a table, defines some properties of the subject in question.

What is Schema?

A schema is the property of the table, and its relation with other tables. It defines the type, size, default value and rules that govern the table in reference to the data within it, and the relation with other tables in the database.

Functions that a DBMS provide

Database management systems provide several functions in addition to simple file management:
• allow concurrency

between 2 tables, if there is a relation, we can set up rules to tell the database to auto update/delete values when there is a change/removal of data in related tables. For example, if a employee is deleted from the organization, all the tables that refer to that employee should be deleted. Or for that matter if we make a employee inactive in the organization, all the tables that hold information for that employee should mark this employee as “inactive”.

• control security

a dbms system also allows role based access kinda rules. We can say that 2 applications will have different access to different tables. For example, the admin department will not know the salary details of the employee. (Remember, that we cannot keep employee details in the same table as the salary, will talk about WHY later).

• maintain data integrity

Data integrity is enforced in both hierarchical and relational database models. The following three integrity constraints are used in a relational database structure to achieve data integrity:

  1. Entity Integrity: This is concerned with the concept of primary keys. The rule states that every table must have its own primary key and that each has to be unique and not null.
  2. Referential Integrity: This is the concept of foreign keys. The rule states that the foreign key value can be in two states. The first state is that the foreign key value would refer to a primary key value of another table, or it can be null. Being null could simply mean that there are no relationships, or that the relationship is unknown.
  3. Domain Integrity: This states that all columns in a relational database are in a defined domain.
  4. The concept of data integrity ensures that all data in a database can be traced and connected to other data. This ensures that everything is recoverable and searchable. Having a single, well defined and well controlled data integrity system increases stability, performance, reusability and maintainability. If one of these features cannot be implemented in the database, it must be implemented through the software.

• provide for backup and recovery
• control redundancy
• allow data independence
• provide non-procedural query language
• perform automatic query optimization