1. 程式人生 > >修改表中數據

修改表中數據

修改表 必須 max distinct run delete rand 現在 table

修改表中數據
格式:
update+表名+set+列名=‘表達式‘+where 條件表達式
update student set name=‘李四‘ where name =‘43‘
刪除表中數據
格式:
delete + from + 表名 +where 條件表達式
說明:當選項缺省時,刪除表中所有數據
delete from student where csrq=‘1998-1-1‘
或者:
格式:
truncate +table +表名
功能:刪除表中所有數據
刪除表:
drop table 刪除表定義及該表的所有數據
語法:
drop table table_name
查詢語句
where 查詢條件
group by 分組查詢
select brand, max(price) from car group by brand 這是通過分組查詢
意思是通過brabd進行分組,現在是分成好幾個組, 然後通過最高的價格摘出來,相當於把每個牌子的最高價格的車型拿了出來。
分組查詢必須跟著函數 這就是函數 max(price)
having 篩選查詢
order by 排序
選擇特定列
select __ , __ from student
去重查詢
distinct語句:
select distinct brand from car
top 句子:
top n [percent] 可以用於查詢前幾列的數據

修改表中數據