0% found this document useful (0 votes)
8 views

Dms 12

Uploaded by

realme7i9767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Dms 12

Uploaded by

realme7i9767
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 16

Interactive SQL and

performer
Represented by:-darekar Vaishnavi namdev.
kachole dropada sopan,
ghatul akanksha madhav.
• Sql stand for structure querry language.

• Sql is used to communicate with a database.

• Sql perform retrive,insert,update,delition.

• DATA TYPES IN SQL


CHAR(LENGTH)
2)varchar(length)
3)Float
4)Integer
5)Float
6)Date
Component of SQL:-
 Truncate
1)DDL(data definition language)
 Create –
Syntax: truncate table table_name;
Syntax= create table table_name(
Ex:- truncate table stud;
column1 datatype[size]
);
 Desc
Ex:- create table student(
Roll_no int,  Syntax:- desu table table_name;
Name varchar(100),
);
Ex:- desu table student;
 Alter command –
 Rename
Syntax:- alter table table name
Add column name datatype[];
Syntax;- alter table table_name rename to new
name;
Ex: alter table stud ex; alter table stud
Add marks int; drop rollno int;
Ex:- alter table stud rename to stud1;
Ex: alter table stud
Modify name varchar(100);
Dml command(data manipulating
Dcl command(data control
language)
language
 Insert-
syntax insert into tablename(column names)
Values(column1,column2); 1)grant:-
Syntax:- grant create ,update,delete on
Ex:-insert into stud(rollno,name) tablename to username;
Values(‘1’,’abc’);
Ex;- grant delete,update,insert on stud to
 Update- jay;
Syntax – update tablename set
column name=new value; 2)Revoke
where(condition);

Ex:- update emp set Syntax:- revoke create ,update,delete on


salary=20000; Tablename to username;

 Delete :- Ex:- revoke create,update,delete on stud


Syntax:- delete from table_name; to jay;

Ex:- delete from emp;


DQL(data querry language)

1)Select

Syntax:- select *from table_name;

Ex:- select *from stud;

Tcl command(transaction control language);-

1)commit-
Syntax:- commit;

2)rollback-
Syntax;- rollback;

3)Savepoint
Syntax:- savepoint name;
Inbuilt function in sql:-
1) String function :-
*lower ():
Select lower(“Rahul”)from student;
*upper():
Select upper(“Rahul”) from student;
*initcap():
Select initcap(“Rahul”)from student;
*Ltrim():
Select ltrim(“Rahul”)from student;
*rtrim():
Select rtrim(“Rahul”)from student;
*length(string)
Select length(“Rahul”) from student;
Date and time function:-

*add month()

*last day()

*month between()

*next day()
2)Arithmetic function
*power();
*abs()
*greatest();
*least();
……………………………………
Aggrigate function:

• Max();
Ex:-Select max (salary) from std;
• Min():
Ex:- Select min (salary) from std;
• Avg:
Ex:- Select avg (salary) from std;
• Count():
Ex:- Select count (salary) from std;
• Sum():
Ex:-Select sum (salary) from std;
Operators:

1.Arithmatic operator:
Addition
Substraction
Multiplication
division
Set operators:

• Union
Ex: select union emp1 id from emp2;
• Union all
Ex: select union all emp1 id from emp2;
• Intersect
Ex: select intersect emp1 id from emp2;
• Minus
Ex: select minus emp1 id from emp2;
Range searching operator:
Between:-

Pattern matching operator:-


Like:-
joins
Use to connect two tables.

• Types of inner join:


Inner join:
Syn:select columnname list from table1
Inner join table2
On table1.columnname=table2.columnname
Outer join:
Syn:select columnname list from
table1
outer join table2
On
table1.columnname=table2.columnn
ame
1.Left outer join
select *from table1
left outer join table2 on
table1.rollno=table2.rollno;

2.right outer join:


select *from table1
right outer join table2 on
table1.rollno=table2.rollno;
3.full outer join:
select *from table1
full outer join table2 on
table1.rollno=table2.rollno;
View:
use to create virtual copy of the database
1.Create view:
Syn: Create view
tablename_view1
As select from tablename;
2.Select at specifc column:
Create view

You might also like