第四章.检索数据 1.检索单个列 该结果返回的数据是为排序的,和添加到表中的顺序是不一样的。 结束SQL语句以(;)来结束。 对所有列和表名是小写的。 2.检索多个列 3.检索所有列 用通配符(*)表示 4.检索不同的行 DISTINCT关键字指示MySQL语句只返回不同的值。distinct关键字 ...
分类:
数据库 时间:
2020-06-15 22:41:10
阅读次数:
82
去重复行,用SQL写很简单,就一句SELECT DISTINCT … FROM。但是文件上没法直接用SQL了,想用SQL还得找个数据库先建表,也很麻烦。如果是小文件,那用java对付一下也不太费劲,大概这样: String file ="d:/urls.txt"; ArrayList<String> ...
分类:
编程语言 时间:
2020-06-15 10:09:59
阅读次数:
114
Where、order by、group by、join、distinct union 后面的字段最好加上索引 ...
分类:
数据库 时间:
2020-06-14 20:45:31
阅读次数:
75
->select查询详解*********** select distinct\top ... --(5)投影 from -- (1)找到表 where -- (2)过滤掉我们不需要的数据 group by --(3)分组操作 having --(4)对分组后的数据进行过滤。 order by -- ...
分类:
其他好文 时间:
2020-06-14 18:55:57
阅读次数:
57
1. mybatis中xml文件特殊字符例如“<”,“>”转义解决方式: ①使用 < 和 >来转义 ②使用标签<![CDATA[ <或> ]]> 2. Redis的部署方式,使用的jar包 3. Zookeeper的选举机制 4. SQL语句的执行顺序(由sql中的别名的使用位置引申出) ...
分类:
其他好文 时间:
2020-06-14 18:52:56
阅读次数:
65
查找重复的电子邮箱 sql 编程 1. 地址 https://leetcode-cn.com/problems/duplicate-emails/ 2. 解法 内连接,或者多表查询 email 相同,但是 id 不同的行 select distinct p1.Email from Person p1 ...
分类:
其他好文 时间:
2020-06-14 15:12:25
阅读次数:
86
从不订购的客户 sql 编程 1. 地址 https://leetcode-cn.com/problems/customers-who-never-order/ 2. 解法 子查询 select Name as Customers from Customers where Id not in ( s ...
分类:
其他好文 时间:
2020-06-14 14:29:06
阅读次数:
76
今日内容概要 如何查询表 """ select where group by having distinct order by limit regexp like ... """ 连表操作理论 今日内容详细 前期表准备 create table emp( id int not null unique ...
分类:
数据库 时间:
2020-06-14 12:46:59
阅读次数:
58
1.数据清洗 步骤: 1.查询charge_record表业务类型为充值且订单状态为成功的数据 2.将上述数据转移到本地数据库 使用如下脚本: # coding=utf-8import pymysql# 原数据库链接db1 = pymysql.connect( host='***', port=33 ...
分类:
数据库 时间:
2020-06-12 19:54:51
阅读次数:
89
HIVE count(distinct ) over() 无法使用解决办法 在使用hive时发现count(distinct ) over() 报错 hive> with da as ( > select 1 a, 'a' b union all > select 1 a, 'a' b union ...
分类:
其他好文 时间:
2020-06-11 14:58:24
阅读次数:
200