ELEMENTS in SQL-1
ELEMENTS in SQL-1
ELEMENTS in SQL-1
c) String/Text
DATATYPE DESCRIPTION
It is of fixed length, used to store text. It has a
char/char(m) default value of 1. m--> represents the maximum
allowed length of the text.
It is of variable length, used to store text. It doesn’t
varchar(m) have any default value. m--> represents the
maximum allowed length of the text.
BLOB It stands for Binary Large Objects, used to store
large binary files or images.
It provides a list of option from which one value
Enum has to be picked up. For eg:
Section enum( ‘A’ , ‘B’ , ‘C’ )
3. Null Values:
4. Comments
a) Single Line commenting
Two ways to perform single line commenting:
i) -- followed by text
ii) # followed by text
b) Multiline commenting
/* anyText */
****************************************************************
MySQL statements (Broad categorization of commands)
1. Data Definition Language (DDL)
2. Data Manipulation Language (DML)
3. Transaction Control Language (TCL)
4. Session Control Commands
5. System Control Commands
Types of Commands
DDL:
Purpose:
1. Where
Sub-clauses
a) Relational Operator: Used to write conditions based on:
➢ < >= <= != = is null
For eg: where salary > 10000 ;
b) Logical operator: Used to write when more than one condition is there base on:
And Or
For eg:
Where salary > 10000 and salary<35000
c) IN : used to write a condition when two or more values are from the same
attribute.
For eg: where att in ( val1, val2, ….. ) ;
d) Between: Used to write a condition for a range of values.
For eg:
Where Fees between 15000 and 44000 ;
e) Like: Used to perform search operation by using pattern.
For eg:
Name starts with A
Where name like ‘A%’ ;
Name ends with B
Where name like ‘%B’ ;
Name contains S
Where name like ‘ % S % ’ ;
3rd Letter of Name is A
Where name like ‘_ _ A % ’ ;
2nd Last letter of Name is A
Where name like ‘ A_ % ’ ;