Introduction To DBMS
Introduction To DBMS
DBMS
Basic Terms
● Data: The raw facts are called data. The word “raw” indicates that they have not
been processed, meaning having no particular meaning. Eg. ABC, 1, 19.
● Database: Organised collection of interrelated data.
● DBMS: Stands for Database Management System
● When dealing with large amounts of data, two things that require optimization:
○ Storage of data and Retrieval of data.
● Data sharing: Sharing is too complex or even not allowed in file system. Whereas in DBMS, data can be
shared easily due to a centralized system.
● Data Searching: In file system, for each search operation, a different application program has to be
written. While in DBMS, users only have to write a query to retrieve data.
● Data Integrity: Integrity constraints are a set of rules, need to be applied to the data before inserting it
into the database. The file system does not provide any procedure to check these constraints on data
automatically. Whereas DBMS maintains data integrity by enforcing user-defined constraints on data
by itself.
● Data Security: A file system provides a password mechanism to protect the database but how long can
the password be protected? No one can guarantee that. Whereas, DBMS has specialised features that
not every user of the database system should be able to access all the data.
Key Features of DBMS
● Data modeling: A DBMS provides tools for creating and modifying data models, which define the
structure and relationships of the data in a database.
● Data storage and retrieval: A DBMS is responsible for storing and retrieving data from the
database, and can provide various methods for searching and querying the data.
● Concurrency control: A DBMS provides mechanisms for controlling concurrent access to the
database, to ensure that multiple users can access the data without conflicting with each other.
● Data integrity and security: A DBMS provides tools for enforcing data integrity and security
constraints, such as constraints on the values of data and access controls that restrict who can
access the data.
● Backup and recovery: A DBMS provides mechanisms for backing up and recovering the data in the
event of a system failure.
Components of DBMS
Components of DBMS
● Hardware: The actual computer system used for keeping and accessing the database.
● Software: It also includes the database software, operating system, network software used to share the data
with other users, and the applications used to access the data. This software component is capable of
understanding the Database Access Language and converting it into actual database commands to execute or
run them on the database. DBMS software examples include MySQL, PostgreSQL, Microsoft Access, SQL
Server, FileMaker, Oracle, RDBMS, dBASE, Clipper, and FoxPro.
● Data: The typical database contains both the metadata(data about data) and the actual(operational) data.
● Procedures: Procedures refer to general instructions to use a database management system. This includes
procedures to setup and install a DBMS, To login and logout of DBMS software, manage databases, take
backups, generate reports etc.
● Database Access Language: Database Access Language is a simple language that allows users to write
commands to perform the desired operations on the data that is stored in the database.used to write
commands to access, upsert, and delete data stored in a database. SQL(structured query language), My Access,
Oracle, etc.
Database Languages
● Data Definition Language (DDL): deals with database schemas and descriptions, of how the data should reside in the
database.
● Data Manipulation Language (DML): deals with data manipulation and used to store, modify, retrieve, delete and update
data in a database.
● Data Control Language (DCL): acts as an access specifier to the database.(basically to grant and revoke permissions to
users in the database
● Transactional Control Language: acts as an manager for all types of transactional data and all transactions.Some of the
command of TCL are
● NoSQL DBMS: Data is organized in the form of key-value pairs, documents, graphs, or column-based.
These are designed to handle large-scale, high-performance scenarios.
● Object-Oriented DBMS (OODBMS): An OODBMS stores data as objects, which can be manipulated
using object-oriented programming languages.
Relational Model in DBMS
● The relational model represents how data is stored in Relational Databases.
● A relational database consists of a collection of tables, each of which is assigned a unique name.
● Consider a relation STUDENT with attributes ROLL_NO, NAME, ADDRESS, PHONE, and AGE shown
in the table.
Important Terminologies
● Attribute: Attributes are the properties that define an entity. e.g.; ROLL_NO, NAME, ADDRESS
● Relation Schema: A relation schema defines the structure of the relation and represents the name of
the relation with its attributes.
a. e.g.; STUDENT (ROLL_NO, NAME, ADDRESS, PHONE, and AGE) is the relation schema for
STUDENT. If a schema has more than 1 relation, it is called Relational Schema.
● Tuple: Each row in the relation is known as a tuple. The above relation contains 4 tuples.
● Relation Instance: The set of tuples of a relation at a particular instance of time is called a relation
instance. Table 1 shows the relation instance of STUDENT at a particular time. It can change
whenever there is an insertion, deletion, or update in the database.
Important Terminologies
● Degree: The number of attributes in the relation is known as the degree of the relation. The STUDENT
relation defined above has degree 5.
● Cardinality: The number of tuples in a relation is known as cardinality. The STUDENT relation defined
above has cardinality 4.
● Column: The column represents the set of values for a particular attribute. The column ROLL_NO is
extracted from the relation STUDENT.
● NULL Values: The value which is not known or unavailable is called a NULL value. It is represented by
blank space. e.g.; PHONE of STUDENT having ROLL_NO 4 is NULL.
Types of Keys in Relational Model
● Candidate Key
● Primary Key
● Super Key
● Alternate Key
● Foreign Key
● Composite Key
SQL
● SQL stands for Structured Query Language and is a computer language that we use to interact with a
relational database.
● SQL is a tool for organizing, managing, and retrieving archived data from a computer database.
● The original name was given by IBM as Structured English Query Language, abbreviated by the acronym
SEQUEL.
● When data needs to be retrieved from a database, SQL is used to make the request. The DBMS processes the
SQL query, retrieves the requested data and returns it to us.
SQL Basics
Additional Links
● Database Schema in detail
● DBMS Interview Questions
● SQL Queries Interview Questions