Structured Query Language
Structured:
Who follows syntax -> set of rules
Query:
Request
Language:
Medium to communicate.
Data: is a raw fact which describe the Properties/Attributes of
Object/Entity.
Object: Anything which has existence [may be living/non-
living].
Eg: cat, dog, fan, tables…etc
Database:
Is a place where we can store the data in a
systematic/organised manner.
Data
Data Base
Basic Operation performed by the Data Base is:
CRUD operation.
Create/Insert.
Read/Retrieve.
Update/Modify.
Delete/Drop.
Database Management System [DBMS]:
It is a software where we can manage and maintain the
database.
In DBMS data is stored in a File
Format.
To interact with the DB we use
QL[Query Language.]
DATABASE
System
Files
format
DBMS
QL
Features:
Security
Authorization.
Drawbacks:
Wastage of Memory.
Fetching time is slow.
** To overcome these issues in DBMS E. F. Codd introduce a
relational based system i.e. RDBMS.
DBMS EXECUTE RDBMS
DATABASE
Relational Database Management System [RDBMS]:
It is a DBMS software which follows relational model to
manage and maintain the database.
Here the data stored in Table format.
To interact with the database, we used SQL.
DBMS
QL
Features:
1. Security.
2. Authorization.
Tables:
It is a combination of rows and column.
Cell:
It is a smallest unit of a table.
Row/Tuple/Record
Cell
Column/Attribute/Fields
Rules of E. F. Codd:
1. Every Cell have must have single value data.
2. In RDBMS we store everything in the form of table,
including metadata.
3. We can store data in multiple tables, if needed we can
make a connection b/w two tables using Key Attributes.
4. We can validate the data entered into the table in two
steps:
1. By assigning datatypes.
2. By assigning Constraints.
NOTE:
Here datatypes are mandatory but constraints are optional.
Datatype:
It is used to determine what type/kind of data will be stored in
a particular memory location.
Datatypes in SQL:
1. CHAR
2. VARCHAR / VARCHAR2
3. NUMBER
4. DATA
5. LARGE OBJECT(LOB)
1. Character LOB (CLOB).
2. Binary LOB (BLOB).
Note:
SQL is not case sensitive.
CHAR Datatype:
Char datatype use character such as
‘A-Z’, ‘a-z’, ’0-9’, special character (*, @, #, --).
Syntax:
Char(size)
Whenever we mention char datatype, we have to mention
size for it.
Max size = 2000;
It is a type of fixed memory allocation.
Wastage of memory due to unused memory to overcome
it we have VARCHAR.
VARCHAR Datatype:
Varchar datatype use character such as
‘A-Z’, ‘a-z’, ’0-9’, special character (*, @, #, --).
Syntax:
varchar(size)
Whenever we mention varchar datatype, we have to
mention size for it.
Max size = 2000;
It is a type of “Variable length memory allocation”.
There is no wastage of memory in varchar.