常用的SQL语句
发布日期:2021-10-24 03:36:21 浏览次数:2 分类:技术文章

本文共 803 字,大约阅读时间需要 2 分钟。

1 -- 建表语句 2 create table t_user( 3  id int PRIMARY KEY, 4  username varchar(20) not null, 5  userpwd varchar(20) not null 6 ) 7  8 -- 插入数据 9 insert into t_user values(1, 'h_bolin', '123');10 insert into t_user values(2, 'h_bolin', '123');11 insert into t_user values(3, 'h_bolin', '123');12 13 -- 查询数据14 select * from t_user;15 select * from t_user where id=1;16 select count(1) from t_user;17 18 19 -- 更新语句20 update t_user set userpwd='456' where id=1;21 22 -- 删除语句23 delete from t_user where id=3;

 当id自增时:

-- 建表语句create table t_user( id int PRIMARY KEY not null auto_increment, username varchar(20) not null, userpwd varchar(20) not null)

 

查询语句如下:

insert 表名(字段2,字段3) values(字段2值,字段3值)

insert into t_user(username,userpwd) values('h_bolin', '123');

 

转载于:https://www.cnblogs.com/H-BolinBlog/p/5261735.html

转载地址:https://blog.csdn.net/weixin_30687587/article/details/94967792 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:第四场 hdu 6069 Counting Divisors (逆向思维)
下一篇:常用排序算法及java语言实现

发表评论

最新留言

网站不错 人气很旺了 加油
[***.192.178.218]2024年04月11日 15时17分44秒