select * from table_name where id = ' '(等于空字符串) 2、查询不为空的犯法 select * from table_name Where id is not null (不为null) select * from table_name where id != ' ' (不等于空字符串) select * from table_name where id <> ' ' (不等于空字符串) 二、Mysql中concat、conc...
Here's what I have for if all the projects have a user assign: SELECT p.name, CONCAT(u.lastName, ', ', u.firstName) AS user, p.dueDate FROM projects p, users u WHERE p.uid = u.id ORDER BY p.id DESC; This results in no results when the p.uid is NULL, and I need it ...
SELECTDATE_FORMAT( T.VISITDATE,'%Y年%m月%d日') 入院时间,GROUP_CONCAT(CONCAT_WS(':', ID, PATIENTTYPE )) 主键 HE患者类型FROMcz_fet_main_zy tWHERET.VISITDATEISNULLORT.FOUTHOSPDATEISNULLGROUPBYT.VISITDATE; 补充说明: IFNULL(expr1,expr2) 参数expr1和expr2可以是具体值,也可以是函数; 不管...
IFNULL(CONCAT_WS(', ', IF(current_country = 'Unknown' OR current_country = 'Not Applicable', NULL, current_country), IF(current_locality = 'Unknown' OR current_locality = 'Not Applicable', NULL, current_locality), IF(current_place = 'Unknown' OR current_place = 'Not Applicable', NUL...
select group_concat(c_province,c_city order by c_province desc) from tablename group by c_province,c_city 19、索引: 创建索引:create index id from tablename(c_id) 创建多字段索引:create index id from tablename(c_id,c_name) 查看索引:show index from tablename ...
上述利用了group_concat()、group by实现了按照一个字段分组后,显示对应分组的所有ID。 3.5、控制流程函数 if(expr,r1,r2):expr是表达式,如果成立返回r1,否则返回r2。 ifnull(v,r):如果v不为null则返回v,否则返回r。 nullif(v1,v2):如果v1 == v2,则返回null,如果不相等则返回V1。 -- if的用例 select...
-- 指定排序方式和分隔符 select department,group_concat(emp_name order by salary desc separator ';' ) from emp group by department; 二、数学函数 操作 三、字符串函数 四、日期函数 五、控制流函数 ▶ if逻辑判断语句 ▶ case when语句 ▶ case when语句 use mydb4; -- 创建订单表 create tab...
concat函数---拼接字符串 ifnull函数--判断是否为空 条件查询部分知识点整理 语法 根据筛选条件不同进行分类 1.按条件表达式筛选 2.按照逻辑表达式筛选 3.模糊查询 like的使用 in的使用 is null和is not null的使用 安全等于 <=> 排序查询 语法 添加筛选条件: 按表达式排序: 按别名排序: 按函数排序: 按多个...
select concat('yun3k', 'com'); (2). 案例2:将YUN3k_com全部转为小写 select lower('YUN3k_com'); (3). 案例3:将yun3k_com全部转为大写 select upper('yun3k_com'); (4). 案例4:将yun3k左边不满足10位的全部填充'a' select lpad('yun3k', 10, 'a'); (5). 案例5:将yun3k右边不满足...
SELECT CONCAT(eid,":",ename) AS result FROM t_employee;2、比较运算符 #二、比较运算符#=,>, <,>=, <=, !=(不等于<>),<=>(安全等于)#查询basic_salary!=10000 SELECT eid,basic_salary FROM t_salary WHERE basic_salary != 10000;SELECT eid,basic_salary FROM t_salary WHERE basic_...