Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

SQL Basic commands

create table table1(
name1 varchar(25) not null,
phone1 varchar(20),
age1 int not null,
primary key (name1)
)
create table table2(
name2 varchar(25) not null,
phone2 varchar(20),
age2 int,
FOREIGN KEY (name2) references table1(name1)
)
 drop table table2

 alter table table1 ADD newcol varchar(25)

 insert into table1(name1,age1) values ('hasa',11)


 insert into table1 values ('hasara','12',12,'nw')

 update table1 set name1='new name' where name1='hasara'

 delete from table1 where name1='hasa'

 select phone1 from table1 where name1='new name' and age1=12

 select * from table1
 select * from table2

 insert into table1(name1,age1) values ('hasa2',12)
  insert into table2(name2,age2) values ('new name',12)
 insert into table1(name1,age1) values ('hasa3',14)

 select * from table1,table2 where age2=12
 select * from table1,table2 where name1='new name'

 select a.name1, b.name2 from table1 a,table2 b

 select * from table1 where age1>5
 select * from table1 where name1 like '%sa%'

  select * from table2 where age2>5 order by age2

  select COUNT (distinct age1) from table1 //ekinekata wenas ewa keeak
  select MAX(age1) from table1
  
  select age1, COUNT(*) from table1 group by age1// 2 twelves in the table, e e samana age walata adala count eka
  select COUNT(*) from table1 group by age1
  
   select age1, COUNT(*) from table1 group by age1
  having COUNT (*)>1

No comments:

Post a Comment