SQL DAY 1 & DAY 2 NOTES
WHAT IS SQL?
➢ SQL stands for Structured Query Language.
➢ It is used for communication with the database.
DATA
Data is a raw-fact which describes the attributes of an Entity.
Examples:
1) Person - entity
Attributes and data(in red) of a person
First name: Rohan
Surname: Singh
Phone number: 9876543210
Dob: 14-MAY-199X
Gender: MALE
2) Laptop - entity
Attributes and data (in red) of a laptop
Brand: Dell
RAM: 8gb
Touch: no
Storage: 1 TB
3) Water Bottle - entity
Attributes and data (in red) of a water bottle
Height: 20 cms
Color: blue
Capacity: 500 ml
DATABASE :
Database is a place or a medium in which we store the data in a systematic and organized manner.
➢ The basic operations that can be performed on a database are
▪ CREATE / INSERT
▪ READ / RETRIEVE
▪ UPDATE / MODIFY
▪ DELETE / DROP
➢ These operations are referred as CRUD Operations.
COMPUTER DATABASE
You have saved
HARD DISK
a PPT in your
computer
PEN DRIVE
DATABASE MANAGEMENT SYSTEM ( DBMS )
It is a software which is used to maintain and manage the database
➢ DBMS provides 2 important features i.e Security and Authorization.
Software
DATA SECURITY & AUTHORISATION
Database QUERY LANGUAGE
DBMS SOFTWARE
➢ We use query language to communicate or interact with DBMS
➢ DBMS stores the data in the form of files.
Example:
FILE A FILE B FILE C
RELATIONAL DATABASE MANAGEMENT SYSTEM( RDBMS )
➢ It is a type of DBMS software in which we store the data in the form of rows and
columns(tables).
➢ It also provides 2 important features i.e security and authorization.
➢ We use SQL to communicate or interact with RDBMS
➢ RDBMS stores the data in the form of Tables.
Software
SECURITY &
AUTHORISATION
Data
STRUCTURED
QUERY Database
LANGUAGE
RDBMS
EXAMPLE:
EMPNO Names Sal
1 A 5000
2 B 6000
3 C 2000
4 D 1000
5 E 2000
RELATIONAL MODEL
➢ Relational Model was designed by E.F CODD.
➢ In Relational Model we can store the data in the form of tables.
➢ Any DBMS which follows Relational Model becomes RDBMS .
➢ Any DBMS which follows rules of EF CODD becomes RDBMS .
Relational RDBMS
DBMS
Model
RULES OF EF CODD
TABLE
➢ It is a logical organization of data which consists of rows and columns.
Columns / Attribute / Fields/properties
Rows/ Cell
Records/
Tuples
➢ The cell is formed by intersection of rows and columns in a table.
➢ The cell is the smallest unit in a table which stores data.
Example: EMP (TABLE)
Employee(entity)
Attributes of
EID ENAME SALARY employee:
RECORDS 1 SMITH 1000 EID, Ename,
OF DIFFERENT Salary
2 ALLEN 1500
EMPLOYEE
3 CLARK 2000