MySQL基础

  1. 云栖社区>
  2. 博客>
  3. 正文

MySQL基础

ali_yun_user 2018-11-15 23:07:03 浏览354
展开阅读全文

a)插入数据
insert into t_user (id, name,password, age, gender) values (null, "zhangsan", "123456", 21, "男");
insert into t_user values(null, 'lucy', 'lucyx', '111111', 22, '女');

Insert into 表名(字段名称) values(字段值);

b)更新数据
update t_user set user_name = 'xyc' where id = 1;

update t_user set user_name = concat(user_name, '-change') where id =     1;

Update 表名 set 要更改的字段名=值 where 条件[and/or]

c)删除数据
delete from t_user where id = 3;
Delete from 表名 where 条件[and/or]

d)基本查询语句
select * from t_user;

select * from t_user where id = 1 ;

Select user_name from t_user; 只查询user_name字段值
Select 字段名 from 表名 where 条件[and/or]; “*”符号代表查询所有 字段

网友评论

登录后评论
0/500
评论