Ashokit SQL t Notes-1
Ashokit SQL t Notes-1
SQL >>
Stands For Structured Query Language With SQL We Can Store, Retrieve,
Select, Extract, Read, Update, And Delete The Data In The Database.
WHAT IS DATA?
The World Is Divided Into Two Things One Is Non-Living Things Another One
Living Things But in Programing Language i.e. C, C++, JAVA, PYTHON, PHP
Everything Will Be Consider as Object.
EXAMPLE -1
OBJECT
PROPERTIES DATA
NAME NIBBA
AGE 24
GENDER MALE
DATEOFBIRTH 14-FEB-2000
HEIGHT 5’1’’ FEET
WEIGHT 56KGS
QUALIFICATION B.TECH
INSTA_ID call_me_nibba
GIRL_FRIEND_NAME NIBBI
HUMAN
EXAMPLE:-2
Properties or Attributes
ENTITY (OBJECT)
WHAT IS DATABASE?
Software
QUERY
LANGUAGE Data
Database
FILE FORMAT
DBMS
We use query language to communicate or interact with DBMS
Software
Data
TABLE (ROW&COLUMNS)
STRUCTURED QUERY
LANGUAGE Database
EXAMPLE
TABLE:
(Or)
Rows Cell
/
Records
/
Tuples
Employee:
Example:
EID ENAME PHONE_NO
1 SMITH 101
2 ALLEN 102 , 202
3 CLARK 103
Rule No 2
Note point:-
DATATYPES
Datatypes in SQL
4. NUMBER(PRECISION ,[SCALE])
5. LARGE OBJECTS
i. Character Large Object. (CLOB)
ii. Binary Large Object (BLOB)
iii.
KEEP IN MIND!
NOTE: SQL is not a Case Sensitive Language.
CHAR (SIZE) DATA TYPE;-
In character datatype we can store 'A-Z' , 'a-z' , '0-9' And Special
Characters( $ , & , @ , ! … ) .
R A M
EXAMPLE ‘ABC123’
VARCHAR (SIZE) DATA TYPE:-
R A M
R A M
Example:
By using char (size) Data Type Varchar2 (size)
STUDENT
USN SNAME ADDRESS PAN_NO
CHAR(4) VARCHAR(10) VARCHAR2(10) CHAR(10)
RAM NIBBA AMEERPET ABC123XYZ1
RAVI NIBBI KPHB ABC123XYZ2
ASSIGNMENT:
DIFFERENTIATE BETWEEN CHAR & VARCHA
ASCII: [American Standard Code for Information Interchange]
FROM DUAL;
'A' 65
'Z' 90
'a' 97
'z' 122
NUMBER (PRECISION,[SCALE])
SYNTAX: NUMBER (Precision, [Scale])
[ ] - Not Mandatory.
Precision: it is used to determine the number of digits used to store
integer value
Scale: it is used to determine the number of digits used to store
decimal (floating) value within the precision
By default scale value is zero (0)
Scale is not mandatory
EXAMPLE WE HAVE TAKEN DIGIT 7
Example : Number ( 3 ) +/- 777
Example : Number ( 5 , 0 ) +/- 77777
Example : Number ( 5 , 2 ) +/- 777.77
Example : Number ( 7 , 3 ) +/- 7777.777
Example : Number ( 4 , 4 ) +/- .7777
Example : Number ( 5 , 4 ) +/- 7.7777
Example : Number ( 3 , 6 ) +/- .000777
Example : Number ( 5 , 8 ) +/- .00077777
Example : Number ( 2 , 7 ) +/- .0000077
'DD-MON-YY' OR 'DD-MON-YYYY'
'12-AUG-24' '12-AUG-2024'
SYNTAX: DATE
EMPLOYEE_DETAILS
LARGE OBJECTS
SYNTAX : CLOB
EXAMPLE
@ # $ ^ 4 5
E 4 7 8 % *
5 ^ ( _* # $
Datatype we can store 'A-Z, 'a-z', '0-9' And Special Characters ($, &, @,
#…).
It is used to store characters up to 4 GB of size.
In Binary Large Object Datatype we can store the Values/data in Binary
Format
SYNTAX: BLOB
EXAMPLE
1` 0 0 0 1 0
0 1 1 1 0 1
0 0 0 0 1 1