0% found this document useful (0 votes)
5 views11 pages

Class 10 IT Section B Unit 3 DBMS Notes

The document provides an overview of Database Management Systems (DBMS), including definitions, components, types, and advantages. It explains key concepts such as data organization, types of DBMS, SQL commands, and data types. Additionally, it covers the roles of users, features of DBMS, and applications in various sectors.

Uploaded by

ishaandevil09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views11 pages

Class 10 IT Section B Unit 3 DBMS Notes

The document provides an overview of Database Management Systems (DBMS), including definitions, components, types, and advantages. It explains key concepts such as data organization, types of DBMS, SQL commands, and data types. Additionally, it covers the roles of users, features of DBMS, and applications in various sectors.

Uploaded by

ishaandevil09
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

Unit 3 – Database Management System

Data Base Management System


Data – In a database, data refers to the collection of facts, figures, or information that is stored
in a structured format. These pieces of information can include things like names, addresses,
dates, numbers, or any other type of information that is relevant to the system or application
using the database.

Base – BASE, which stands for Basically Available, Soft state, eventually consistent, is a data
management principle that provides an alternative to the traditional model for database
management.

Management – Management in a Database Management System (DBMS) refers to the set of


activities involved in creating, organizing, maintaining, securing, and optimizing a database.

System – In a Database Management System (DBMS), the term “system” typically refers to the
software system used to manage the database.

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.

Database Concepts:- Database contains objects that are used for


storing and managing information.

1. Item : - Item is about which information is stored in the database.


2. Field:- Each question that we ask about our item is a Field.
3. Record:- Record is a set of information (made up of fields) stored in your database
about one of the items.
4. Value:- Value is the actual text or numerical amount or date that you put in while
adding information to your database.

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 in 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

Advantages of Database
1. Reduces Data Redundancy : no chance of encountering duplicate data

2. Sharing of Data : the users of the database can share the data among themselves

3. Data Integrity : Data integrity means that the data is accurate and consistent in the
database

4. Data Security : Only authorised users are allowed to access the database and their
identity is authenticated using a username and password

5. Privacy : The privacy rule in a database states that only the authorized users can access a
database according to its privacy constraints

6. Backup and Recovery : Database Management Systemautomatically takes care of


backup and recovery.

7. Data Consistency : Data Consistency means there should bemultiple mismatching


copies of the same data.: no chance of encountering duplicatedata

8. Sharing of Data : the users of the database can share the dataamong themselves

9. Data Integrity : Data integrity means that the data is accurate andconsistent in the
database

10. Data Security : Only authorised users are allowed to access thedatabase and their
identity is authenticated using a username andpassword

11. Privacy : The privacy rule in a database states that only theauthorized users can access a
database according to its privacyconstraints

12. Backup and Recovery : Database Management Systemautomatically takes care of


backup and recovery.

13. Data Consistency : Data Consistency means there should bemultiple mismatching
copies of the same data.
Features of DBMS
1. Data modelling: A DBMS provides tools for creating and modifying data models,
which define the structure and relationships of the data in a database.
2. 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.
3. 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.
4. 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.
5. Backup and recovery: A DBMS provides mechanisms for backing up and
recovering the data in the event of a system failure.
6. DBMS can be classified into two types: Relational Database Management System
(RDBMS) and Non-Relational Database Management System (NoSQL or Non-
SQL)
7. RDBMS: Data is organized in the form of tables and each table has a set of rows
and columns. The data are related to each other through primary and foreign keys.
8. NoSQL: 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.

Applications of DBMS
1. Enterprise Information: Sales, accounting, human resources, Manufacturing,
online retailers.
2. Banking and Finance Sector: Banks maintaining the customer details, accounts,
loans, banking transactions, credit card transactions. Finance: Storing the
information about sales and holdings, purchasing of financial stocks and bonds.
3. University: Maintaining the information about student course enrolled information,
student grades, staff roles.
4. Airlines: Reservations and schedules.
5. Telecommunications: Prepaid, postpaid bills maintance.

Database Servers – Database servers are dedicated computers that hold the actual
databases and run only the DBMS and related software. Databases on the database servers
are accessed through command line or graphic user interface tools referred to as Frontends;
database servers are referred to as Back-ends. Such type of data access is referred to as
Client-server model.

RDBMS:- A relational database management system (RDBMS) is a database management


system that is based on the relational model. In the relational model of a database, all data
is represented in terms of tuples (rows), grouped into relations (tables). A database
organized in terms the relational model is a relational database.
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)

DDL is the short name for Data Definition Language, which deals with database schemas
and descriptions, of how the data should reside in the database.
1. CREATE: to create a database and its objects like (table, index, views, store
procedure, function, and triggers)
2. ALTER: alters the structure of the existing database
3. DROP: delete objects from the database
4. TRUNCATE: remove all records from a table, including all spaces allocated for the
records are removed
5. COMMENT: add comments to the data dictionary
6. RENAME: rename an object
1. CREATE – It is used to create a new database or table.

CREATE DATABASE

SYNTAX: CREATEDATABASE<DATABASE_NAME>;

EXAMPLE: CREATEDATABASEmyschool_db;

USE DATABASE – To create a table USE Database command is required.

SYNTAX: USE<DATABASE_NAME>;

EXAMPLE: USEmyschool_db;

CREATE TABLE

SYNTAX: CREATETABLEtable_name(column_definition1, column_definition2,........,........);

EXAMPLE: CREATETABLEemployee(e_idint(8),e_namechar(30));

2. ALTER – It is used to modify the structure of an existing database or table.

TO ADD COLUMN (FIELD)

SYNTAX: ALTERTABLE<Table_Name>ADDCOLUMN<Column_Name><Data_Type>;

EXAMPLE: ALTERTABLE employee ADDCOLUMNe_locchar(50);

TO REMOVE/DROP COLUMN (FIELD)

SYNTAX: ALTERTABLE<Table_Name>DROPCOLUMN<Column_Name>;

EXAMPLE: ALTERTABLE employee DROPCOLUMNe_loc;


3. DROP – Deletes an existing database or table.

TO DROP TABLE

SYNTAX: DROPTABLE<Table_Name>;

EXAMPLE: DROPTABLE employee;

TO DROP DATABASE

SYNTAX: DROPDATABASE<Database_Name>;

EXAMPLE: DROPDATABASEmyschool_db;

4. TRUNCATE – Remove all table records including allocated table spaces, but not the table
itself.

SYNTAX: TRUNCATETABLE<Table_Name>;

EXAMPLE: TRUNCATETABLE employee;

5. RENAME – It is used to change the name of existing database or table.

SYNTAX: ALTERTABLE<Table_Name>RENAMETO<New_Table_Name>;

EXAMPLE: ALTERTABLE employee RENAMETO customers;

Data Manipulation Language (DML)


DML is the short name for Data Manipulation Language which deals with data
manipulation and includes most common SQL statements such SELECT, INSERT,
UPDATE, DELETE, etc., and it is used to store, modify, retrieve, delete and update data in
a database. Data query language (DQL) is the subset of “Data Manipulation Language”.
The most common command of DQL is SELECT statement. SELECT statement help on
retrieving the data from the table without changing anything in the table.
1. SELECT: retrieve data from a database
2. INSERT: insert data into a table
3. UPDATE: updates existing data within a table
4. DELETE: Delete all records from a database table
5. MERGE: UPSERT operation (insert or update)
6. CALL: call a PL/SQL or Java subprogram
7. EXPLAIN PLAN: interpretation of the data access path
8. LOCK TABLE: concurrency Control
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: INSERTINTO<Table_Name>(Field 1, Field 2,….)VALUES(Value1,Value2,….);

EXAMPLE: INSERTINTO employee („e_id‟, „e_name‟,)VALUES(1, “Mukesh”);

Method 2:

SYNTAX: INSERTINTO<Table_Name>VALUES(Value1,Value2,….);

EXAMPLE: INSERTINTO 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: SELECTe_name,e_idFROM<Table_Name>;

SELECT Command Clauses


 WHERE clause specifies a criteria about the rows to be retrieved.
 ORDER BY clause specifies an order (ascending/descending) in which the rows
(records) are to be retrieved.
To retrieve all records:
SELECT*FROM<Table_Name>;

To retrieved records from specific fields:


SELECT Field1, Field2,…FROM<Table_Name>;

By using WHERE clause:

SELECT*FROM<Table_Name>WHERE condition;

SELECT Field1, Field2,…FROM<Table_Name>WHERE condition;


By using ORDER BY clause:

Bydefault Ascending order

SELECT*FROM<Table_Name>ORDERBYEName;

in Descending order

SELECT*FROM<Table_Name>ORDERBYENameDESC;

3. UPDATE – Sometimes, you need to modify the existing records in the table. The UPDATE
command of the SQL can be used for this purpose.

SYNTAX: UPDATE<Table_Name>SET Column1 = Value1,Column2 = Value2,….WHERE condition;

EXAMPLE: UPDATE employee SETLast_Name=„Sharma‟ WHERE E_ID=101;

4. DELETE – It is used to remove the existing records from a table.

SYNTAX: DELETEFROM<Table_Name>WHERE condition;

EXAMPLE: DELETEFROM employee WHERE E_ID=101;

Important: CREATE TABLE BY ASSIGNING PRIMARY KEY


EXAMPLE: CREATETABLE Employee1 (Emp_IDINTNOTNULLPRIMARYKEY, ENAME
VARCHAR(20), AGE INT(5));

MYSQL Functions
MySQL has many built-in functions. Some of them are as: COUNT( ), SUM( ), AVG( ),
MAX( ), MIN( )

COUNT( ) – The COUNT() function returns the number of rows that matches a specified
criterion.

SELECTCOUNT(*)FROMtable_nameWHERE condition;

SELECTCOUNT(column_name)FROMtable_nameWHERE condition;

SUM( ) – The SUM() function returns the total sum of a numeric column.

SELECTSUM(column_name)FROMtable_nameWHERE condition;

AVG( ) – The AVG() function returns the average value of a numeric column.

SELECTAVG(column_name)FROMtable_nameWHERE condition;
MAX( ) – The MAX() function returns the largest value of the selected column.

SELECTMAX(column_name)FROMtable_nameWHERE condition;

MIN( ) – The MIN() function returns the smallest value of the selected column.

SELECTMIN(column_name)FROMtable_nameWHERE condition;

Wildcard Characters in SQL


 % – represent zero or more characters
Example: bl% finds bl, black, blue, and blob
 _ – Represents a single character
Example: h_t finds hot, hat, and hit
 [] – Represents any single character within the brackets
Example: h[oa]t finds hot and hat, not hit or hut
 ^ – Represents any character not in the brackets
Example: h[^oa]t finds hit, hut not hot and hat
 Hyphen (-) – Represents a range of characters
Example: c[a-d]t finds cat and cbt, cct, cdt

GROUP BY Statement
The GROUP BY statement groups rows that have the same values into summary rows, like
“find the number of customers in each country”.

The GROUP BY statement is often used with aggregate functions (COUNT, MAX, MIN, SUM,
AVG) to group the result-set by one or more columns.

GROUPBY Syntax:

SELECTFUNCTION(ColumnName)FROMtable_nameWHERE condition GROUPBYcolumn_name;

Example:

SELECTCOUNT(CustomerID), country FROM customers GROUPBY country;

Categories of data types:-


Data types can be broadly classified into five categories:-
1. Numeric Types2. Alphanumeric Types
3. Binary Types4. Date Time
5. Other variable Types
NUMERIC TYPES:
They are used for describing numeric values like mobile number,age, etc.
The different types of numeric data types available are-
1. Boolean (Yes / No)2. TinyInt (Tiny Integer)
3. SmallInt (Small Integer)4. Integer
5. BigInt (Big Integer)6. Numeric
7. Decimal8. Real
9. Float10. Double

ALPHANUMERIC TYPES:-

The list of different datatypes available in alphanumeric types are


1. LongVarChar (Memo) (Long Text)2. Char (Text-fix) (Small Text)
3. VarChar (Text) (Text of specified Length)4. VarChar_IgnoreCase (Text) (Comparisions
are not case sensitive)

BINARY TYPES:-

Binary types are used for storing data in binary formats. It can be used for storing photos, music
files or (in general file of any format) etc.
The list of different datatypes available in Binary types are :-
1. LongVarBinary (Image)2. Binary (Binary (fix)
3. VarBinary (Binary)

DATE TIME:-

Date time data types are used for describing date and time values for the field used in the table
of a database. It can be used for storing information such as date of birth, date of admission etc.

You might also like