NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO.
2502
Commands of SQL
1.Create Table:- it is used to create the
table.
Syntax:- create table <table name>
(column 1 specification,column 2
specification,……);
2. Insert The Record:- this command is
used for insert the information.
Syntax:- insert into <table name>
values(‘values1’,’values2’,…….);
3. Select command:- it is used to select
all the row in this table.
Syntax:- select * from <table name>;
For selecting a specific column:- for
selecting the specific column.
Syntax:- select column 1name,……
from<table name>;
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
4. Update The Content Of Table:- it is used
to change the information in the table.
Syntax:- update < table name> set
column name 1 =expression,…..where
column name= Expression;
5 . Modify the structure of table:- it
mean changing in the table like add the
column.
(1)Adding new column:-
Syntax:- alter table <table
name>add(new column 1 data
type(size),..…);
(2).Adding the information:-
To add the information we use the
update command.
Syntax:-update <table name > set
column name expression….where
column =expression;
6. Deletion Operation:-
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
(1).delete the specific no. of row:- those
row are deleted where the condition are
given.
Syntax:- delete from <table name> where
search condition;
(2).deletion of all row:- if we delete our all
row.
Syntax:- delete <table name>;
(3).delete the table:- this command is used
if we delete our table.
Syntax:- drop <table name>;
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
FUNCTION OF SQL
2. Avg(average):-
Syntax:- avg([distinct/All]n).
Purpose:-retrun average value of n
ignorancy null values.
3.Min(minimum):-
Syntax:- min([distinct/All]expression]n);
Purpose:- Return minimum values of
expression.
4.Max(maximum):-
Syntax:- max([distinct/All]expression);
Purpose:-Return maximum values of
expression.
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
5.Count(*):-
Syntax:- count(*);
Purpose:- Return the no. of rows including
duplicate & null.
6.Sum:-
Syntax:- sum ([distinct/All]n);
Purpose:-Return sum of values.
7.ABS(absolute):-
Syntax:- abs(n);
Purpose:- Return the absolute value of n.
8. Power:-
Syntax:- power(m,n);
Purpose:- return m raised to the nth power,n
must be integer.
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
9.Round(n[m]):-
Syntax:- round(n[m]);
Purpose:- return n rounded to m place right of
decimal point.
10. Sort(square root):-
Syntax:- sort(n);
Purpose:- return square root of n.
11. Lower:-
Syntax:- lower(char);
Purpose:- return character with lower case.
12. Upper:-
Syntax:- upper(char)
Purpose:- return character with upper
case.
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
13.Initcap(initial caption):-
Syntax:- initcap(char)
Purpose:- return string with first letter is
capital.
14.Substr:-
Syntax:- substr(char, m[n])
Purpoes:- return a portion of character
begining at character m,n character long.
15.Length:-
Syntax:- length(char)
Purpose:- return the length of character.
16.LTRIM(left trimming):-
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Syntax:- ltrim[char{,set}]
Purpose:- remove char from left.
17.RTRIM(right trimming):-
Syntax:-rtrim[char{,set}]
Purpose:- remove char from right.
18.LPAD (left padding):-
Syntax:- LPAD (CHAR1,N [,CHAR 2])
Purpose:- return char1, left padded to length
n.
19.RPAD(right padding):-
Syntax:- RPAD( char1, n[char2])
Purpose:- Return char1,right padded to length
n.
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani
NAME:- JYOTI B.SC. COMP. SCI. (5rd Sem.) ROLL NO. 2502
Adarsh Mahila Mahavidyalaya,Bhiwani