Mysql之增删改查

1.添加数据(把user改为你的表名)

   1).单条插入

          insert into user(user_id,user_name,password,name,sex,card_id,tel,addr,overtime) values(7,'xiao',123456,'张三','男','370125199xxxxxxxxx','1306503xxxx','山东省','2020-06-08');

   2).多条插入(这样执行效率要高一些)

        insert into user(user_id,user_name,password) values(7,'xiao',123456),(6,'xiao3',123456);

   3).将查询结果插入到表中

        

2.删除数据

   delete from user where user_id>=0;

3.自增列

   1).设置自增列:alter table user modify user_id int(11) auto_increment;(如果要设置起始值在auto_increment后添加=x,x为起始值)

   2).取消自增属性:alter table user modify user_id int(11);

   

猜你喜欢

转载自www.cnblogs.com/xiaofakun/p/9440018.html
今日推荐