Class 10 IT Section B Unit 3 DBMS Notes
Class 10 IT Section B Unit 3 DBMS Notes
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.
System – In a Database Management System (DBMS), the term “system” typically refers to the
software system used to manage the 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.
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
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
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.
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.
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;
SYNTAX: USE<DATABASE_NAME>;
EXAMPLE: USEmyschool_db;
CREATE TABLE
EXAMPLE: CREATETABLEemployee(e_idint(8),e_namechar(30));
SYNTAX: ALTERTABLE<Table_Name>ADDCOLUMN<Column_Name><Data_Type>;
SYNTAX: ALTERTABLE<Table_Name>DROPCOLUMN<Column_Name>;
TO DROP TABLE
SYNTAX: DROPTABLE<Table_Name>;
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>;
SYNTAX: ALTERTABLE<Table_Name>RENAMETO<New_Table_Name>;
Method 1:
Method 2:
SYNTAX: INSERTINTO<Table_Name>VALUES(Value1,Value2,….);
SYNTAX: SELECT*FROM<Table_Name>;
EXAMPLE: SELECTe_name,e_idFROM<Table_Name>;
SELECT*FROM<Table_Name>WHERE condition;
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.
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;
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:
Example:
ALPHANUMERIC TYPES:-
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.