0% found this document useful (0 votes)
34 views3 pages

SQL Commands

Uploaded by

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

SQL Commands

Uploaded by

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

Commands  

create table (

 
);

primary key (a1,a2,........)  

foreign key (a1, a2,........) references r  

drop table r;  

delete from r;

OR

 
delete from r

where P;

alter table r add A1 A2;  

alter table r drop A1;  

select A1, A2,.....

from r1, r2,.........


 
where P;

distinct r  

where and, or, not  

as  

like 'intro% %intro% _ _ _ _ _ _%'

 
not like

*  

select

from
 
order by A1 asc/dsc, A2 asc/dsc,..........

between / not between  

union, intersect, except

 
union all, intersect all, except all

null arithmetic

 
null comparision

unknown and, or, not  

is null, is not null

 
is unknown, is not unknown

avg, sum, count, min, max

 
coalesce(_ , _)

group by  
Commands  

/* */ --  

select

from

where
 
group by

having;

A1 in r

 
not in (returns boolean)

some (r)

 
all (r)

< some, <= some, <> some  

exists r

 
not exists r (compare with in/ not in) (returns boolean)

unique r

 
not unique r (returns boolean)

with as  

insert into r

values ( , , ,)

OR
 
insert into r (A1,A2,A3......)

values ( , , , )

update r

set A =
 
where P;

update

set A = case

when P1 then _

 
when P2 then _

else

end

   

   

   

   
Commands  

   

   

   

   

   

   

   

   

   

   

   

   

You might also like