程序媛计划——mysql 插入、查找、修改、删除数据
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了程序媛计划——mysql 插入、查找、修改、删除数据,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含2692字,纯文字阅读大概需要4分钟。
内容图文
insert into exam_score values (1,‘Zhao‘,95.33),(2,‘Qian‘,94.33),(3,‘Sun‘,44.55),(4,‘Li‘,33.55); Query OK, 4 rows affected (0.01 sec) Records: 4 Duplicates: 0 Warnings: 0#展示整张表 mysql> select * from exam_score; +----+------+-------+ | id | name | score | +----+------+-------+ | 1 | Zhao | 95.33 | | 2 | Qian | 94.33 | | 3 | Sun | 44.55 | | 4 | Li | 33.55 | +----+------+-------+ 4 rows in set (0.00 sec)
mysql> insert into exam_score values (5,‘Zhou‘,66.33),(6,‘Wu‘,99.32),(7,‘Zheng‘,33.2),(8,‘Wang‘,99.3); Query OK, 4 rows affected (0.00 sec) Records: 4 Duplicates: 0 Warnings: 0
#查询按照字段id在0到2之间的行数据 mysql> select * from exam_score order by id limit 0,2; +----+------+-------+ | id | name | score | +----+------+-------+ | 1 | Zhao | 95.33 | | 2 | Qian | 94.33 | +----+------+-------+ 2 rows in set (0.00 sec)
#查询整张表中的前两行 mysql> select * from exam_score limit 0,2; +----+------+-------+ | id | name | score | +----+------+-------+ | 1 | Zhao | 95.33 | | 2 | Qian | 94.33 | +----+------+-------+ 2 rows in set (0.00 sec)
#按照name字段升序显示整张表 mysql> select * from exam_score order by name asc; +----+-------+-------+ | id | name | score | +----+-------+-------+ | 4 | Li | 33.55 | | 2 | Qian | 94.33 | | 3 | Sun | 44.55 | | 8 | Wang | 99.30 | | 6 | Wu | 99.32 | | 1 | Zhao | 95.33 | | 7 | Zheng | 33.20 | | 5 | Zhou | 66.33 | +----+-------+-------+ 8 rows in set (0.01 sec)
#按照name降序显示 mysql> select * from exam_score order by name desc; +----+-------+-------+ | id | name | score | +----+-------+-------+ | 5 | Zhou | 66.33 | | 7 | Zheng | 33.20 | | 1 | Zhao | 95.33 | | 6 | Wu | 99.32 | | 8 | Wang | 99.30 | | 3 | Sun | 44.55 | | 2 | Qian | 94.33 | | 4 | Li | 33.55 | +----+-------+-------+ 8 rows in set (0.00 sec)
#where条件查询 mysql> select * from exam_score where name=‘Li‘; +----+------+-------+ | id | name | score | +----+------+-------+ | 4 | Li | 33.55 | +----+------+-------+ 1 row in set (0.00 sec) mysql> select * from exam_score where id=3; +----+------+-------+ | id | name | score | +----+------+-------+ | 3 | Sun | 44.55 | +----+------+-------+ 1 row in set (0.00 sec) mysql> select * from exam_score where name=‘Zhao‘ and score<=99.0; +----+------+-------+ | id | name | score | +----+------+-------+ | 1 | Zhao | 95.33 | +----+------+-------+ 1 row in set (0.00 sec)
程序媛计划——mysql 插入、查找、修改、删除数据
标签:计划 sql exist not cat duplicate 字段 rds rem
本文系统来源:http://www.cnblogs.com/IcarusYu/p/7496771.html
内容总结
以上是互联网集市为您收集整理的程序媛计划——mysql 插入、查找、修改、删除数据全部内容,希望文章能够帮你解决程序媛计划——mysql 插入、查找、修改、删除数据所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。