转载

mysql基本操作

mysql的增删查改

Student表 (Sno, Sname, Ssex,Sage)为例

  • insert基本用法
 insert into Student (Sno, Sname, Ssex, Sage) values('1', '小明', '男', 20);
 insert into Student(Sno, Ssex, Sage, Sname) values('1','男', 20, '小明');
 insert into Student values('1', '小明', '男', 20) **必须与列相对应* 
  • delete基本用法
delete from Student where Sno='1'; 
delete from Student ;**删除全表**
  • select基本用法
   select * from Student where Sno='1'; **选取全部列**
   select Sno, Sname from Student where Sno='1';**选取部分列**
  • update基本用法
update Student set Sage=22 where Sno='1';
update Student set Sage=Sage+1; **全表更新**
正文到此结束
本文目录