SQL - Structured Query Language
ANSI
DQL - Data Query Language
SELECT / FROM/WHERE /GROUP BY/HAVING/ORDER BY
DDL - Data Definition Language
CREATE
ALTER - ADD
- MODIFY
- RENAME
- DROP
- SET UNUSED
DROP
TRUNCATE
RENAME
COMMENT
DML- Data Manipulation Language
INSERT
UPDATE
DELETE
MERGE
TCL - Transaction Control Language
COMMIT
ROLLBACK
SAVEPOINTS
DCL - Data Control Language
GRANT
REVOKE
DATA - Raw Facts
PROCESS- Fetching/reading/querying ---(SQL)
INFORMATION - Processed Data
DATABASE - an organised form of data
Table
COLUMNS - Attributes - Properties
ROWS - Records - Tuples
ID Name Add Ph Email DOB
1001 ABC sia 345345 abc@xyz 10-02-2000
1002 XYZ chi 5453 xyz@ab 11-04-1987
Why do we keep data into separate tables?
or
What is normalization ?
NUMBER - INT/ FOAT/DOUBLE
$56,877.878
456657.56567
DATE - TIMESTAMP
10/09/24
DD-MON-RR
10-SEP-24
CHARCTER - VARCHAR/VARCHAR2/STRING
Alphabets
number
symbols
Rules
unique - no duplicates
null - unknown/inapplicable/not available
not null - mandatory
unique + not null
primary key - unique + not null
alternate/secondary key - unique + not null
referential/foreign key -primary key /unique key can be referenced in different
tables
countryid locationid empid ename .......
91 100 101010
01 100 101010
01 200 120121
NORAMLIZATION
1st NForm - all the values should be atomic in field
2nd NForm - 1 NF + 1 PRIMARY KEY
3rd NForm- 2n NF + x - is a super key
y - candidate key
separate table for all the columns dependent on Y
DENORMALIZATION - Joining