Introduction of SQL
SQL (Structured Query Language): It is a language which is used to
interact/communicate with database.
Communicate
Data
Database
History of SQL
SQL ------> 1970----> Raymond Boyce
(Data Scientist) IBM
When he invented SQL. He named SQL as SEQUEL (Simple English Query
Language)
Then after in:
1986 ---> ANSI (American National Standard Institute)
ANSI took over SEQUEL and changed its name to SQL.
DATA
“Data is a raw fact which describes attributes of an entity.”
Properties are also called attributes.
Entity is also called an object.
Properties or Attributes
EXAMPLE:
Entity/Object Attribute/Property
Height: 20cms
Color: Green
Capacity: 500 ml
Water Bottle
DATABASE
“Database is a place or a medium in which we store the data in systematic &
organized manner.”
Data
+ SYSTEMATIC
+ ORGANIZED
DATABASE
The basic operations that can be performed on a database are
CREATE/INSERT
READ/RETRIEVE
UPDATE/MODIFY
DELETE/DROP
These operations are referred to as “CRUD” operations.
DBMS (Database Management System)
“It is a software which is used to maintain and manage the database”
In DBMS software we have two main features
Security
Authorization
In DBMS we store the data in file format.
To communicate with DBMS, we are using Query Language.
+ Security
Query Language
+ Authorization
File Format
Database
DBMS
RDBMS (Relational Database Management System)
“It is a type of DBMS software used to maintain & manage the database.”
In RDBMS software we have two main features
Security
Authorization
In RDBMS we store the data in the form of table (rows & columns)
To communicate with RDBMS, here we are using Structured Query
Language.
+ Security Structured Query Language
+Authorization
Table format
Database
RDBMS
Difference Between DBMS & RDBMS
DBMS RDBMS
It is a software used to maintain It is type of DBMS software used to
and manage the database. maintain and manage the database
In DBMS we store data in File In RDBMS we store data in Table
format. format.
To communicate with DBMS, we To communicate with RDBMS we
use query language. are using SQL
Performing CRUD operation is Performing CRUD operation is easy.
Difficult compared to RDBMS
RELATIONAL MODEL
Relational model was designed by famous data scientist E.F CODD (Edgar
Frank codd)
In Relational model we store data in the form of rows & columns(Tables).
Any DBMS which follows Relational model becomes RDBMS.
DBMS. Relational Model RDBMS
Any DBMS which follows rules of E.F CODD becomes RDBMS.
TABLE
“It is a logical organization of data which consists of columns & rows.”
Columns / Attribute / Fields
Rows
Cell
/
Records
/
Tuples
Columns: It describes single properties of all the entity
Rows: It describes all the properties of a single entity
Cells: It is a smallest unit of a table OR intersection between rows &
columns generates a space that is called as cell.
EXAMPLE:
E_ID Ename Sal
1 SMITH 1000
2 ALLEN 1500
3 CLARK 2000
RULES OF E.F CODD
1. The data entered into a cell must always be a single valued data.
Example:
EID ENAME PH_NO
1 SMITH 1234567890
2 ALLEN 1234568790,
4567889012
3 CLARK 1234689060
EID ENAME PH_NO ALTERNATE_NO
1 SMITH 1234567890
2 ALLEN 1234568790 4567889012
3 CLARK 1234689060
2. In RDBMS, we can store everything in the form of table including
metadata.
Metadata: The details about data or data about data is known as metadata.
EID ENAME PHOTO
1 SMITH
PHOTO
2 ALLEN
Image Name: Nature
3 CLARK Size:127kb
Resolution: 400 x 600
DATA Format: jpeg
Meta Table
Image Name Size Resolution Format
Nature 127kb 400 x 600 .jpeg
Meta Table: The table which stores meta data is called as meta table.
3. According to E.F CODD, we can store data in multiple tables if
needed we can establish connection between the tables using key
attributes. Need to
establish
Employee connection Department
E_id Ename Age D_no Dname loc
101 Subhan 30 10 D1 L1
102 Priya 28 30 D2 L2
103 Aditya 32 20 D3 L3
4. The data entered into a table can be verified in two steps
By assigning Datatypes
By assigning Constraints