INFORMATICS PRACTICES
IP-065
IP NOTES
UNIT-3
DATABASE CONCEPT USING SQL
GRADE-11
SESSION 2025-26
Submitted By: Submitted to:
CHAPTER – 3
DATABASE CONCEPT USING SQL
DATA
Data is a raw fact or unprocessed information.
Or
Data is a collection of raw facts like text, figures, observations , that can interpreted and
processed to gave meaningful insights. Raw facts like : number, text, images, sound,
animations, symbol, or any structured or instructed formats.
DATABASE
A database is a collection of data or information that is arranged in the organised way so
that it can easily accessed, managed, stored and updated.
In the database, data is organised into rows and columns & tables.
Database is indexed to make it easier to find relevant information.
Database is just like a container which contains the various objects like table, queries,
reports [Link] organised way
Why do we need database
Accuracy
Security of data
Data integrity
To manage large amount of data
Easy to update data
DBMS
DBMS stands for Data Management System.
A DBMS refers to a software that is responsible for storing, maintaining and utilizing
database in an effective and efficient way.
A database along DBMS software Is called database system.
Example of DBMS – following are the some main example of DBMS
MS Access
MySQL
Paradox
DB – 2
Oracle
MS SQL server
Advantages of DBMS/Database
1) database ensure security or protect
tion against unauthorized modification or any intentional disclosure
2) database maintains integrity.
3)database reduces redundancy/ duplicity
4) database controls inconsistency.
5) database facilitates sharing of data.
RDBMS
DATA MODEL
Data mode is a model or presentation which shows how data is organised ? or stored data in
the database.
A data is modelled by one of the following data model
1) rational data model
2) network data model
3) hierarchical data model
4) object oriented data model
RATIONAL DATA MODEL
A rational data model into relations or table i.e. rows & columns.
A row in a table represent a relationship of a data to each other or also called a tuple or
record.
In a table the column represents called a attribute or field.
RDMS
RDMS stands for the Relational Database Management.
A relational database is a collective set of multiple data, organised by tables, records and
columns.
Relational database established a well define relationship database tables.
Tables communicates and share information which facilitates data search ability, organised and
reporting.
A relational database use SQL(Structured Query Language), which is a standard
user application that provides an easy programming interface for database interactions.
RDBMS Terms
Database relational ( table)
A relational table is a matrix like structure arrange in rows and columns.
The relational / table as the following properties :
1) Atomicity
2) No duplicity
3) Homogenous column
4) Ordering of rows & column is immaterial.
DOMAIN.
It is the collection of values from which the value derive for a column.
TUPLE/ RECORD/ ENTITY
Rows of table is called tuple/record / entity
FIELD/ ATTRIBUTE
Column of a table is called attribute/ field.
DEGREE
No. of column or attributes In a table is called Degree.
CARDINIALITY
No. of rows or record In a table is called Cardinality
KEYS IN A DATABASE
KEY: a key an important role in relational database. It is used for identifying unique
rows from table and establishes relationship among the table on demand.
TYPES OF KEYS IN DBMS
There are many types of keys in DBMS are as follows –
Primary key
Candidate key
Alternate key
Foreign key
Unique key
Composite key
Super key
PRIMARY KEY
A primary key is a column or set of column in a table that uniquely identifies rows (tuple) in
that table.
Alternate key
Out of all candidate keys plays only one key get selected as a primary key remaining other
keys are known as alternate key or a secondary key.
Candidate key
It is an attribute or a set of attribute that participates for a primary key certain process and
to uniquely identify each other record in that table.
SQL (Structured Query Language)
SQL stands for Structured Query Language.
It is a standard language developed and used for accessing and modifying relational
database.
The SQL Language was originally developed at IBM’s research laboratory California,
USA, connection with a project a develop prototype for a relational, database
management system called System R in 1970’s.
Examples of SQL –
SQL is being used by many database management system . Some of them are –
My SQL
SQLite
Postgre SQL
Oracle
Microsoft SQL server
ADAVANTAGES OF SQL –
Following are the same main advantages of using SQL –
Portability
High speed
No proper coding needed ( only small statement )
Well defined language
Interactive language
Multiple data view
My SQL
My SQL is currently the most popular open source database software. It is a multi-
user, management system.
My SQL is especially popular on the web world.
It is one of the part of very popular LAMP – platform. Like –Linux, Apache , My SQL,
PHP are the LAMP platform.
My SQL was founded by Michael Widens, David A-Mark and Allen Larnusan in
Sweden in 1995.
FEATURES OF MY SQL –
Following are the very important features of My SQL –
Portability
Security
Connectivity
Open – source and free of cost
Query language
TYPES OF SQL COMMAND –
Following are the some important command of SQL –
DDL( Data Definition language )
DQL (Data Query Language )
DML ( Data Manipulation Language )
DCL ( Data Control Language )
TCL ( Transactional control Language )
DDL
DDL stands for Data Definition Language.
DDL create database and table structure command .
OR
DDL is a set of SQL are commands used to create user, who should be accessing the
database by an application.
LIST OF DDL COMMAND –
CREATE
DROP
ALTER
TRUNCATE
COMMENT
RENAME
DQL
DQL stand for Data Query Language.
DQL command is used to retrieve the data from database.
OR
DQL command is a component of SQL statement that allows getting data from
database and imposing order upon it.
The purpose of the DQL command is to get some scheme a relation based on a
query.
LIST OF DQL COMMAND –
SELECT
DML
DML stands for Data Manipulation Language.
DML command is used on the rows / records related to operations.
OR
The DML command deal with the manipulation of data present in the database.
DML command includes most of the SQL statements.
LIST OF DML COMMANDS –
INSERT
DELETE
UPDATE
LOCK
CALL
DCL
DCL stands for Data Control Language
DCL command is used to manipulate permission or access write to the tables.
LIST OF DCL COMMANDS –
GRANT
REVOKE
TCL
TCL stands for Transactional Control Language.
TCL command is used to control the transactions of data/ database.
OR
TCL command are used to control the education of transaction.
LIST OF TCL COMMAND –
COMMIT
ROLLBACK
SAVE POINT
DATABASE COMMAND IN MY SOL
Creating a Database
My SQL > CREATE database My SQL;
DELETE a database
My SQL > DROP database My SQL;
SHOW Database or Table
My SQL> SHOW database My SQL;
My SQL> SHOW Table T_Name;
REMOVE or DELETE TABLE
My SQL> DROP Table T_Name;
CREATE A DATA IN DATABASE WITH USE STATEMENT
My SQL > USE MYSQL;
CREATE A TABLE IN THE DATABASE IN ARCIEVED WITH CREATE
TABLE STATEMENT
My SQL > CREATE TABLE Student ( student_name )
Varchar command (25 ) , FRAME vachar(25), class char(4);
VIEW THE TABLE STRUCTURE (DESCRIBE) –
The DESCRIBE command is used to view structure of table.
My SQL>DESCRIBE Student;
INSERT NEW ROW IN A TABLE –
To insert a new into existing table with the help of INSERT command
My SQL> INSERT INTO Student value (‘ Adarsh ’, ‘ Deepak _Gupta’_, 11 A);
Similarly we can insert multiple records and with the help of SELECT command we can
retrieve inserted rows ( previous).
My SQL> SELECT * FROM Student;
WHERE CLAUSE
Selecting rows by using the where clause in the SELECT command like :
My SQL > SELECT * FROM Student WHERE class= ‘11’
UPDATE COMMAND –
To modify or update entries in the table used the UPDATE command like:
My SQL > UPDATE Student SET class = ‘11’
WHERE Student_Name= “Adarsh”;
DELETE COMMAND –
My SQL > DELETE FROM Student WHERE
Name=”Adarsh”;
BETWEEN COMMAND –
To access data in the specify range the use BETWEEN command like:
My SQL> SELECT * FROM Student WHERE class BETWEEN ‘X’ and ‘XII’;
ORDER BY CLAUSE -
A query result can be ordered in ascending (A to Z) or descending (Z to A) order as per the
any column.
By default the column order will be ascending.
For example:
My SQL> SELECT * FROM Student ORDER BY CLAUSE DESC;
TABLE CONSTRAINTS IN SQL DATABASE
The following constraints are commonly used in SQL database:
Primary key
Foreign key
Not null
Unique
Check
Default
Index