![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL学习
文章平均质量分 75
刘阿童木
这个作者很懒,什么都没留下…
展开
-
SQL基础11--增删改
参考表:学员信息表:person id name age 1 atom 19 2 atom2 19 3 atom3 21 4 atom4 21 5 atom5 25 6 atom6 25 这次用到这一个表就行了,更改过的数据我会事实截图放到内容里1、增(插入) INSERT INTO 表(要插入的列) VLALUES (插入的值)增就是插入,使用语法 I...原创 2021-10-31 16:44:14 · 99 阅读 · 0 评论 -
SQL基础10--多表查询(3)
参考表:学员信息表:person id name age 1 atom 19 2 atom2 19 3 atom3 21 4 atom4 21 5 atom5 25 6 atom6 25 班级列表:class id name class 1 atom class1 2 atom2 class1 3 ato...原创 2021-10-26 23:16:10 · 367 阅读 · 0 评论 -
SQL基础9--多表查询(2)
参考表:学员信息表:person id name age 1 atom 19 2 atom2 19 3 atom3 21 4 atom4 21 5 atom5 25 班级列表:class id name class 1 atom class1 2 atom2 class1 3 atom3 class2 4...原创 2021-10-25 23:48:00 · 113 阅读 · 0 评论 -
SQL基础8--多表查询(1)
之后要涉及到多表了,所以又重新梳理出来三个表学员信息表:person id name age 1 atom 19 2 atom2 19 3 atom3 21 4 atom4 21 5 atom5 25 6 atom6 25 班级列表:class id name class 1 atom class1 2 atom2 ...原创 2021-10-20 22:54:20 · 95 阅读 · 0 评论 -
SQL基础7--分组相关(GROUP BY 和 HAVING)
参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 5 atom 33 6 atom2 33 1、创建分组GROUP BY如果我要统计,person表中同姓名的各有多少人应该怎么计算呢?这时候就要用到分组函数 group by了,在表达式中,select后的查询条件一定要与group by的分.原创 2021-10-16 22:18:35 · 290 阅读 · 0 评论 -
SQL基础6--函数
目录1、求平均值AVG()2、计数 COUNT()3、最大值 MAX()4、最小值MIN()5、求和SUM()6、聚合所有函数参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 1、求平均值AVG()如果我们要求用户表中的所有人的平均年龄应该怎么办呢?(1)使用函数AVG()来计算平均值.原创 2021-10-14 15:53:59 · 111 阅读 · 0 评论 -
SQL基础5--where 过滤数据3
参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 1、IN操作符2、NOT操作符3、LIKE操作符4、%通配符5、_通配符原创 2021-10-14 10:16:20 · 114 阅读 · 0 评论 -
SQL基础4--where 过滤数据2
参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 1、AND操作符如果我们想要搜索年龄为22岁的atom,应该怎么搜索呢?这时候就可以使用and连接符来操作了,在where的过滤条件中用and来关联两个过滤条件SELECT name,age from person where name = "atom" and age =.原创 2021-10-14 03:30:00 · 150 阅读 · 0 评论 -
SQL基础3--where 过滤数据
目录1、过滤数据where2、过滤小于某个范围的数据3、过滤姓名不为atom的数据4、过滤年龄为20-30中间的数据参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 1、过滤数据where如果我们只想搜索姓名为atom的数据应该怎们办?按正常的select去搜索,在最后加上where要过滤的字段...原创 2021-10-13 17:56:33 · 436 阅读 · 0 评论 -
SQL基础2-- order by(排序)
目录1、对单列进行排序 order by2、对多个列进行排序3、倒叙排序 desc4、对个别列倒叙排序,然后个别列正序排序参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 1、对单列进行排序 order by要求按年龄从小到大排序应该怎么办?在需要排序的字段前加ORDER BY SELECT nam...原创 2021-10-13 09:46:47 · 6868 阅读 · 0 评论 -
SQL基础1--select
参考数据表名:person id name age 1 atom 111 2 atom2 22 3 atom3 33 4 atom 22 一、select基本搜索简单理解就是想搜索什么内容从哪里1、select 要搜索的内容(要搜索的列) from 位置(表)如:想要搜索所有的年龄 select age from person2、搜索多个列想要搜索多个列怎么办?在sele...原创 2021-10-12 14:50:42 · 225 阅读 · 0 评论