1. 程式人生 > >增刪改查(不完全)

增刪改查(不完全)

val birt null each like 別名 eache 5-0 tinc

--增加
insert into Student values (‘108‘,‘曾華‘,‘男‘,‘1997-09-01‘,‘95033‘)
insert into Student(class,Sbirthday,ssex,sname,son)values
(‘95033‘,‘1975-10-02‘,‘男‘,‘匡明‘,‘105‘)
--刪

--delete from Student 全部刪除
delete from Student where Ssex = ‘null‘
--改
update Student set Sbirthday=‘1977-09-01‘where Son=‘108‘

--查
select * from Teacher
select * from Student where Sname=‘匡明‘
select * from Student where Sbirthday > ‘1975-01-01‘
--模糊查詢
select * from Student where Sname like ‘%王%‘
--排序查詢
select * from Student order by class ,Son desc
--去重查詢
select distinct class from Student
--分組查詢
select class,COUNT(*) from Student group by Class

select Decree,AVG(*) from Score group by Decree 問題

--子查詢
select * from Student where Class in (‘95033‘,‘95031‘)

select * from Score where Decree between 70 and 90


--別名
select sno as 學號
,Con as 班級
,decree from Score

增刪改查(不完全)