Bharat National Public School/HES
Class X (Session: 2022 - 2023)
Information Technology (NSQF Code: 402)
RDBMS NOTES
Database: A database is an organized collection of data. You can visualize it as a container of information.
DBMS: DBMS stands for Database Management System. It is a software package that helps in creating, maintaining, and
using a database. Examples of Database programs are Microsoft Access, OpenOffice.org Base, and MySQL
Two types in which data can be stored in RDBMS:
Flat File: In this, data is stored in a single table (used for less data).
Relational: In this, Data is stored in multiple tables and the tables are linked using a common field (used for large data).
Database Servers:
Database servers are the dedicated computers that hold the actual databases. There are two interface tools/ types of
database servers: FRONTENDS & BACKENDS
Frontends refers to the user interface or application that enables accessing the data.
Back-end they provide the database services to other computers.
RDBMS: A Relational Database Management System (RDBMS) is a database management system that is based on the relational
model introduced by E. F. Codd in 1969. In RDBMS, all the data is represented in terms of tuples, grouped into relations.
A relational database is a collective set of multiple data sets organized by tables, records and columns.
A Relational database uses Structured Query Language (SQL), which is a standard user application that provides an easy
programming interface for database interaction.
Advantages of Database:
• Reduces Data Redundancy: There were sometimes multiple copies of the same file which lead to data redundancy. This is
prevented in a database as there is a single database and any change in it is reflected immediately. Because of this, there is
no chance of encountering duplicate data.
• Sharing of Data: In a database, the users of the database can share the data among themselves. There are various levels
of authorisation to access the data, and consequently the data can only be shared based with the authorized users.
• Data Integrity: Data integrity means that the data is accurate and consistent in the database.
• Data Security: Only authorised users should be allowed to access the database and their identity should be authenticated
using a username and password.
• Privacy: The privacy rule in a database states that only the authorized users can access a database according to its privacy
constraints.
• Backup and Recovery: Database Management System automatically takes care of backup and recovery. Moreover, it also
restores the database after a crash or system failure to its previous condition.
• Data Consistency: Data consistency is ensured in a database because there is no data redundancy. Data Consistency
means there should be multiple mismatching copies of the same data.
Key features of database:
● A database can have one or many tables.
● Each table in a database contains information about one type of item. A database is a container that holds tables and
other objects.
● There should be record uniqueness in every table.
● Every database table should have one or more fields designated as key.
Table It is a set of values that is organized using columns and rows. A table has a defined number of columns and any
number of rows. For eg. EMPLOYEE table
Item Each entry in a database is considered as item.
Columns or Fields or Attributes A column is a set of data values of a particular simple type, which contains the values of
same data type. For eg. EMP_ID, EMP_NAME
Rows or Records or Tuples A row also called a Record or Tuple represents a single, data item in a table.
Primary Key (PK): A primary key is a unique value that identifies a row in a table. The data entered in Primary key cannot be
repeated. Primary key is also known as the Parent Key. For eg. In a table EMPLOYEE, EMP_Id will be the primary key.
Foreign Key (FK): The foreign key identifies a column or set of columns in one (referencing) table that refers to a column or
set of columns in another (referenced) table. It is also known as the Child Key.
For eg., EMP_Id which is in the EMPLOYEE table is a foreign key in another table.
Note: There can be many Foreign Key (many child) but only one Primary Key (one parent)
Composite Primary Key: When primary key constraint is applied on one or more columns then it is known as Composite
Primary Key.
Data types: Data types are used to identify which type of data (value) we are going to store in the database.
Different data types:
Numeric Data Type used to store numeric values. For eg. EMP_PHONE. Eg., Integer, Boolean, Decimal, Float, Double.
Alphanumeric Data Type used to store both numbers & characters in a field. For eg. EMP_ADDRESS.
Types of Alphanumeric Data type : LONGVARCHAR, CHAR, VARCHAR
By default all the fields will have a Text[VARCHAR] data type.
Char: It stores exactly the length specified by the user.
Varchar: It stores up to the specified length according to the length of data entered by the user.
Binary Data Type used to store photos, music files, etc. in a database. Its types: LONGVARBINARY, BINARY, VARBINARY
Date & Time Data Type used for storing date and time values for the field. For eg. EMP_DOB, EMP_DOJ
Types of Date, time Data type: Date, Time, Timestamp (Stores date and time information)
Other Data Type it includes the java objects.
DDL & DML:
DDL Data Manipulation Language (DDL) used to define the structure of a table in a database. It helps to create, modify &
remove database objects such as tables. DDL statements are : CREATE, ALTER and DROP.
DML Data manipulation language (DML) helps the user to access and manipulate data in a database. DML statements
operate on the data of a table in a database. DML statements are: SELECT, INSERT, DELETE and UPDATE.
The use of below DDL and DML statements:
CREATE It is a DDL statement, used to create database & table.
ALTER It is a DDL statement, used to modify the structure of a table.
DROP It is a DDL statement, used to delete the table from database.
SELECT It is a DML statement, used to retrieve zero or more rows from one or more database tables.
INSERT It is a DML statement, used to add a new record in the table.
DELETE It is a DML statement, used to remove the record from the table.
UPDATE It is a DML statement, used to modify an existing record in a table.
There are different ways to create a table:
1. Create table in Design View
2. Use Wizard to Create Table
Field Properties To change the field properties table structure in design view has to be changed.
The properties of numeric type data:
AutoValue – if set to yes then field will get the auto numeric values.
Length – By default length of the field is 10 but the size of the field can be set to maximum length.
Default Value – A default value can be set for a field if user don’t provide any value while entering the values in the table.
Format example – This property helps to set the format of the data entered in the field such as 91-222-333.
The properties of character type data:
Entry Required – if set to yes then it will be must to insert the value in the field which means that field cannot be left blank.
Length – By default length of the field is 10 but the size of the field can be set to maximum length.
Default Value – A default value can be set for a field if user don’t provide any value while entering the values in the table.
Format example – This property helps to set the format of the data entered in the field such as 91-222-333.
Query: A Query means to extract the information from the large amount of data. It helps to access & filter the required data
from a table.
Filtering: Filtering is the process to get the desired/ required data from a table in a database. It hides the remaining data
while showing the required information. Filter uses the SELECT DML statement to retrieve the data.
The SELECT statement has many optional clauses:
● WHERE specifies which rows to retrieve.
● ORDER BY specifies an order in which to return the rows.
Sorting data: Sorting means to arrange the data in either ascending order or descending order.
Referential integrity: Referential integrity is used to maintain accuracy and consistency of data in a relationship.
The relationship between tables means a connection between two or more tables. We do not need to enter the same data
in different tables. Relationship between tables helps in:
● Saving time,
● Reducing data entry errors, and
● Summarizing data from related tables
There are three types of Relations which can be created between tables:
● One to One: In this relationship, both the tables must have primary key columns.
● One to Many or Many to One: In this relationship, one of the tables must have a primary key column.
● Many to Many: In this relationship, no table has the primary key column.
Form: Form is an interface in a user-specified layout that lets users to view, enter, and change data directly in database
objects such as tables. A form provides the user a systematic way of storing information into the database.
Report: A report helps to display the data in a summarized manner. It is used to generate the overall work outcome in a clear
format. You can create reports in the database. Report helps to get the summarized data.