Database Management System or DBMS in short, refers to the technology of storing and retrieving user’s data with utmost efficiency along with safety and security features. DBMS allows
its users to create their own databases, which are relevant with the nature of work they want. These databases are highly configurable and offers bunch of options.
Database is collection of data, which is related by some aspect. Data is collection of facts and figures which can be processed to produce information. Name of a student, age, class
and her subjects can be counted as data for recording purposes.
Mostly data represents recordable facts. Data aids in producing information, which is based on facts. For example, if we have data about marks obtained by all students, we can then conclude about toppers and average marks etc.
Users
DBMS is used by various users for various purposes. Some may involve in retrieving data and some may involve in backing it up. Some of them are described as follows:
Administrators: A bunch of users maintain the DBMS and are responsible for administrating the database. They are responsible to look after its usage and by whom it should be used.
Designer: This is the group of people who actually works on designing part of database. The actual database is started with requirement analysis followed by a good designing process.
End Users: This group contains the persons who actually take advantage of database system. End users can be just viewers who pay attention to the logs or market rates or end users can be as sophisticated as business analysts who take the most of it.
Purpose of RDBMS:
A relational database will allow you to store data organized such that you can store your information in tables, organized by rows (records) and columns (fields) which you can then store and access as required.
The features of a relational database is storage minimization - you, as a DB designer try and use the least storage that you can and still be able to access the data efficiently.
If you then need to retrieve any data, you would 'query' the database (ask it) if record exists in the database or not. This interaction is done via SQL - Structured Query Language - to get the records (rows) that you need.
By utilizing a well-structured database, you can store a lot of information and retrieve it quickly.
Data Models
Data model tells how the logical structure of a database is modeled. Data Models are fundamental entities to introduce abstraction in DBMS. Data models define how data is connected to each other and how it will be processed and stored inside the system.
The very first data model could be flat data-models where all the data used to be kept in same plane.Because earlier data models were not so scientific, they were prone to introduce lots of duplication and update anomalies.
1. Hierarchical Model: The hierarchical data model organizes data in a tree structure.
2. Network Model: Some data were more naturally modeled with more than one parent per child.Therefore, the network model permitted the modeling of many-to-many relationships in data.
3. Object-Oriented Model: Object DBMSs add database functionality to object programming languages.
Relational Model
The most popular data model in DBMS is Relational Model. It is more scientific model then others. This model is based on first-order predicate logic and defines table as an n-any relation.
Concepts
Tables: In relation data model, relations are saved in the format of Tables. This format stores the relation among entities. A table has rows and columns, where rows represent records and columns represents the attributes
Tuple: A single row of a table, which contains a single record for that relation, is called a tuple.Relation instance: A finite set of tuples in the relational database system represents relation instance. Relation instances do not have duplicate tuples.
Relation schema: This describes the relation name (table name), attributes and their names.
Relation key: Each row has one or more attributes, which can identify the row in the relation (table) uniquely, is called the relation key.
Attribute domain: Every attribute has some pre-defined value scope, known as attribute domain.
The main highlights of this model are:
• Data is stored in tables called relations.
• Relations can be normalized.
• In normalized relations, values saved are atomic values.
• Each row in relation contains unique value
• Each column in relation contains values from a same domain.
Data Definition Language
Data Definition Language (DDL) statements are used to define the database structure. Some examples:
• CREATE - to create objects in the database
• ALTER - alters the structure of the database
• DROP - delete objects from the database
• TRUNCATE - remove all records from a table, including all spaces allocated for the records are removed
• COMMENT - add comments to the data dictionary
• RENAME - rename an object
Create database: The CREATE DATABASE statement is used to create a database.
Syntax: CREATE DATABASE your_name;
Create Table: The CREATE TABLE statement is used to create a table in a database.
Tables are organized into rows and columns and each table must have a name.
CREATE TABLE Student
(
RollNo int,
LastName varchar(255),
FirstName varchar(255),
Address varchar(255),
City varchar(255)
);