添加表數據
方法一: insert into staff (name,sex,age) values('小王','1','19')
方法二 : insert into staff values('','小李','1','20')
注:sex::1代表男; sex::0代表女
補充:將本表數據幾何性重複增加 (表數據輕鬆過百萬)//將添加和查詢結合使用
insert into staff (name,sex,age) select name,sex,age from staff
查詢表數據
方法一: select * from staff #查詢所有數據
方法二: select age from staff #查詢表中的年齡字段,顯示所有的年齡
方法三 : select * from staff where id = 1; #查詢表中的id等於1的數據
方法四: select * from staff order by age desc limit 1; #將年齡進行降續排序取出年齡最大的一條 注:limit 0,3 從第1條數據開始向後去三條
.
.
修改表數據
方法一: update staff set name='新值' #將表中所有員工名的數據修改成新值
方法二 : update staff set age=age+1 where sex = 1 #將表中所有男員工年齡加一歲
方法三 : update staff set name='小王' where id = 1 #將id爲1的員工姓名改爲小王