What is a Database?
Database is a systematic collection of organized data or information typically stored on a electronic media in a computer system. With database data can be easily accessed, managed, updated, controlled and organised.
Many website on the world wide web widely use database system to store and manage data (commonly referred as backend).
Advantages of Database
Minimize Data Redundancy: In traditional File processing system same piece of data may be held in multiple places resulting in Data redundancy (duplicacy). Database system minimizes redundancy by data normalization.
Increased Data consistency: When multiple copies of same data do not match with one another is called as data inconsistency.
Data Security: Database allows only the authorized user to access data in the database.
Data Sharing: Database allow its users to share data among themselves.
Data Integrity: Data in the database accurate and consistent.
Database Management System (DBMS)
A DBMS refers to a software that is responsible for storing, maintaining and utilizing database. Some examples of the popular database software include MySQL, Microsoft Access, Microsoft SQL Server, FileMaker Pro, Oracle Database, and dBASE.
Data Model:
A data model is the way data is organised in a database. There are different types data models controls the representation of data in a database, these are:
•Relational Data model
•Network Data Model
•Hierarchical Data Model
•Object Oriented Data Model
The Relational data Model is far being used by most of the popular Database Management Systems. In his course we limit our discussion on Relational data model.
Relational Data Model
In Relational data model data is organized into tables( rows and columns). Tables in a relational model is called as Relations. Each row of a relation represents a relationship between all the values in the row.
Relational Database:
A relational database is collection of multiple data sets organised as tables. A relational database facilitates users to organize data in a well defined relationship between database tables/relations. It uses Structured Query Language(SQL) to communicate with the database and efficiently maintain data in the database.
Relation & Associated Terminologies
Relational Database Terminologies
Tuple/Record: In Relational Database, rows in the Relation/Table are referred as records
Attributes/Fields: Columns are referred as Attributes/Fields.
Cardinality: Total number of records in the relation is called as its Cardinality.
Degree: Total number of Attributes/Fields in the relation is called as its Degree.
Domain: permitted range of values of an attribute for an entity.
Primary key: The attribute or the set of attributes that uniquely identifies records in a relation is called as the Primary key of the Relation.
Types of Keys:
Candidate Key: A Candidate key is a attribute/set of attributes that uniquely identifies tuples in a relation. A relation may be more then one candidate key.
Primary Key: A Primary key is a attribute/set of attributes that uniquely identifies tuples in a relation. All the values in the primary Key need to be unique and NOT NULL.
Among all the candidate keys the Database Administrator(DBA) selects one as Primary key. A relation may have multiple Candidate Keys but ONLY ONE Primary Key.
Alternate Key: A alternate is basically is/are those candidate key which is/are not used as Primary key of the relation.
Foreign Key: Foreign key is a attribute of a relation(called as Child table) that referes to the Primary Key of another relation(called as parent table).