0% found this document useful (0 votes)
6 views

Database Management System

IT 402

Uploaded by

Deepika IT
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Database Management System

IT 402

Uploaded by

Deepika IT
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Database Management System

A Database Management System is a software package with computer programs that


controls the creation, maintenance, and use of a database. It allows organizations to
conveniently develop databases for various applications. A database is an integrated
collection of data records, files, and other objects. A DBMS allows different user
application programs to concurrently access the same database.
Well known DBMSs include Oracle, IBM DB2, Microsoft SQL Server, Microsoft Access,
PostgreSQL, MySQL, FoxPro, and SQLite.
A database model is basically used by the following users:
1. Developers: design and develop a database.
2. Administrators: keep track on database and check authorization to provide
access to the users. (Admin) / DBA
3. End users: are the group of people who really use the database program. For
example, in a school, teachers and students are the end users as they use the
database every day.
Key components of Database
 Columns are referred as fields. A field describes a specific property of a record,
that is why a field is also known as an attribute.
 Rows are referred as records. A single record is also known as tuple.
 A set of characters that represents a valid value is known as data or data
value or data item.

Different types of Database Management System


Following are the different types of DBMS:
1. Relational Database Management System (MySQL)
2. Hierarchical Database Management System
3. Network Database Management System
4. Object-Oriented Database Management System
Types of Data in Database
Data can be organized int two types:
1. Flat File: A flat file is a simple type of data storage format in which data is
stored in a single table with a series of rows and columns. It is used to store
small amount of data. Example: MS Excel
2. Relational: A relational database uses multiple tables with defined
relationships between them to store data. It is used to store huge amount of
data and can be accessed and queried using Structured Query Language (SQL).
Example: MS Access, MY SQL
Advantages of Database
1. Reduces Data Redundancy
2. Reduces Data Inconsistency
3. Increases Data Integrity
4. Sharing of Data
5. Sharing of Resources
6. Data Security
7. Privacy
8. Backup & Recovery
Features of Database
Database Server
The database server is responsible for storing, managing, and retrieving data from
one or more databases, and for handling requests from clients that wish to access or
modify the data.
RDBMS (Relational Database Management System)
It is a type of database. It uses a structure that allows us to identify and access data in
relation to another piece of data in the database. Often, data in relational database is
organized into tables. In a relational database each row is defined in the table is a
record with a unique ID called the key.
Types of Keys in Database

1. Primary Key – A primary key is a field or column that uniquely identifies the
each record.
2. Composite Primary Key – Composite primary key is a key of two or more
attributes that uniquely identifies the row.
3. Foreign Key – A foreign key is a field or a set of fields in a table that refers to
the primary key of another table.
4. Alternate Key – An alternate key is a candidate key that is not chosen to be the
primary key.
5. Candidate Key – A candidate key is a unique key that can be used as a primary
key.
SQL (Structured Query Language)
SQL (Structured Query Language) is the language used in RDBMS for writing queries.
Using SQL, a user can create queries to fetch and manipulate the data of the
database.
The SQL commands are of two types (according to syllabus):
1. Data Definition Language (DDL)
2. Data Manipulation Language (DML)
Data Definition Language (DDL)
These commands are used to define and modify the structure of a database. The
commands that fall under this category are listed as follows:
1. CREATE – It is used to create a new database or table.
CREATE TABLE
SYNTAX: CREATE TABLE table_name(column_definition1,
column_definition2, ........ ,........);
EXAMPLE: CREATE TABLE employee(e_id int(8), e_name char(30));
Que: Write a command and query to create the structure of a table named
“student1”.

Roll_no Class Name Marks

Ans: CREATE TABLE Student1 (Roll_No INT, Class CHAR, Name CHAR, Marks INT);
2. ALTER – It is used to modify the structure of an existing database or table.
TO ADD COLUMN (FIELD)
SYNTAX: ALTER TABLE <Table_Name> ADD COLUMN <Column_Name> <Data_Type>;
EXAMPLE: ALTER TABLE employee ADD COLUMN e_loc char(50);
TO REMOVE/DROP COLUMN (FIELD)
SYNTAX: ALTER TABLE <Table_Name> DROP COLUMN <Column_Name>;
EXAMPLE: ALTER TABLE employee DROP COLUMN e_loc;
3. DROP – Deletes an existing database or table.
TO DROP TABLE
SYNTAX: DROP TABLE <Table_Name>;
EXAMPLE: DROP TABLE employee;
TO DROP DATABASE
SYNTAX: DROP DATABASE <Database_Name>;
EXAMPLE: DROP DATABASE myschool_db;
4. TRUNCATE – Remove all table records including allocated table spaces, but not the
table itself.
SYNTAX: TRUNCATE TABLE <Table_Name>;
EXAMPLE: TRUNCATE TABLE employee;
5. RENAME – It is used to change the name of existing database or table.
SYNTAX: ALTER TABLE <Table_Name> RENAME TO <New_Table_Name>;
EXAMPLE: ALTER TABLE employee RENAME TO customers;
Data Manipulation Language (DML)
A DML (Data Manipulation Language) is a computer programming language used for
adding (inserting), modifying (updating) and data in database. The commands that fall
under this category are listed as follows:
1. INSERT – The insert command is used to add one or more records to a table. There
are two methods to use the INSERT command.
Method 1:
SYNTAX: INSERT INTO <Table_Name> (Field 1, Field 2,….) VALUES (Value 1, Value 2,….);
EXAMPLE: INSERT INTO employee (‘e_id’, ‘e_name’,) VALUES (1, “Mukesh”);

Method 2:
SYNTAX: INSERT INTO <Table_Name> VALUES (Value 1, Value 2,….);
EXAMPLE: INSERT INTO employee VALUES (1, “Mukesh”);
2. SELECT – It is used to retrieves or fetch the data from the table.
TO FETCH ENTIRE RECORD OF TABLE [* means ALL records]
SYNTAX: SELECT * FROM <Table_Name>;
EXAMPLE: SELECT * FROM employee;
TO FETCH RECORD OF SELECTED FIELDS FROM TABLE
SYNTAX: SELECT <Field1, Field2,…> FROM <Table_Name>;
EXAMPLE: SELECT e_name, e_id FROM <Table_Name>;

You might also like