Relational Database Management System 10 Notes
Relational Database Management System 10 Notes
Relational Database Management System 10 Notes
pIT
application programs to concurrently access the same database. Some of
the DBMSs are Oracle, IBMDB2, Microsoft SQLserver, MicrosoftAccess,
PostgreSQL, MySQL, FoxProand SQLite.
Advantages of Database
Reduces Data Redundancy : no chance of encountering duplicate data
ee
Sharing of Data : the users of the database can share the data among themselves
Data Integrity : Data integrity means that the data is accurate and consistent
in the database
Data Security : Only authorized users are allowed to access the database
and their identity is authenticated using a user name and password
nd
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.
Data Consistency : Data Consistency means there should be multiple
mismatching copies of the same data.
sa
Database Concepts :- Database contains objects that are used for storing and
managing in formation.
1. Item:- Item is about which information is stored in the
pIT
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.
ee
For example, Database: Employee
Emp_Code Emp_Name Emp_Address Emp_Designa Emp_ContactNo Emp_Salary
t io
Item: Employee
nd
Field: Emp_Code, Emp_Name, Emp_Address, Emp_Designation,
Emp_ContactNo, Emp_Salary
Record:
sa
pIT
2. Alphanumeric Types
3. Binary Types
4. Date Time
5. Other variable Types
ee
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) 6. Numeric
2. Tiny Int (Tiny Integer) 7. Decimal
nd
3. Small Int (Small Integer) 8. Real
4. Integer 9. Float
5. Big Int (Big Integer) 10.Double
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 data types 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.
The list of different data types available In Date Time type are :-
1. Date (Stores month, day and year information)
2. Time (Store hour, minute and second information)
3. Timestamp (Stores date and time information)
pIT
PRIMARY KEY :- A primary key is a unique value that identifies a row in a
table. These keys are also indexed in the database, making it faster for
the database to search are cord.
Note :- The “one” side of a relation is always the parent, and provides the
PK(PrimaryKey) Attributes to be copied. The “many” side of a relation is
always the child, into which the FK(Foreign Key) attributes are copied.
nd
Memorize it: one, parent, PK(PrimaryKey); many, child, FK (ForeignKey)
There are two types of languages:-
1. DDL(Data Definition Language)
2. DML(Data Manipulation Language)
sa
Types of DML :-
1. Procedural :- The user specifies what data is needed and how to
get it.
2. Non Procedural :- The user only specifies what data is needed.
Note :- A popular data manipulation language is SQL(Structured
pIT
Query Language.)
In this article on SQL Commands, I am going to consider the below
database as an example, to show you how to write commands.
Employee_Info
ee
Emergency
Employee Employee Phone Address City Country
Contact Name
ID Name Number
CREATETABLEEmployee_Info
DROP : To Delete
DROPDATABASEEmployee (complete information
present in the database will be lost)
DROPTABLETableName (complete information
present in the table will be lost)
TRUNCATETableEmployee_Info(your information will be lost, but
not the table)
pIT
DELETE : This statement is used to delete the existing records in a
table
DELETEFROMEmployee_InfoWHEREEmployeeName='Preeti';
SELECT : This statement is used to select data from a database and
the data returned is stored in a result table, called the result- set.
SELECTEmployeeID,EmployeeNameFROMEmployee_Info;
(*)is used to select all from the table SELECT*FROMEmployee_Info;
ee
nd
sa