寫在前面
創(chuàng)建表‘sc’代表學(xué)生成績(jī)單型檀;
創(chuàng)建屬性‘con’代表‘課程’冗尤,容我失策‘cno’寫成‘con’;
創(chuàng)建屬性‘sno’代表學(xué)生的學(xué)號(hào)胀溺;
創(chuàng)建屬性‘score’代表分?jǐn)?shù)裂七;
基礎(chǔ)篇
查詢所有列:*代表all
select * from sc;查詢指定列:直接加屬性名
select score from sc;去重:添加‘distinct’
select distinct score from sc;條件查詢:添加where,還有l(wèi)ike、in仓坞、and背零、or
select score from sc where score>70;排序:order by 屬性
select score from sc order by score desc(/asc);分頁:前面pageindex,后面pagenumber
select * from sc limit 0,5;
select * from sc limit 5,5;插入
insert into sc (con,sno,score)values(1,11,99);更新
update sc set score = 88 where sn0 = 11;刪除
delete from sc where sno = 10;as
select distinct a.sno from
(select sno,score from sc where con = 1) a,
(select sno,score from sc where con = 2)b
where a.score > b.score
order by a.sno
limit 0,10;