博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
expert php and mysql_Expert PHP and Mysql
阅读量:5754 次
发布时间:2019-06-18

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

SELECT IFNULL(NULL,’Value is NULL’) AS result1,

IFNULL(1 > 2, ‘NULL result’) AS result2;

mysql> SELECT NULLIF(TRUE,TRUE) AS istrue,

NULLIF(TRUE,FALSE) AS isfalse,

NULLIF(TRUE,NULL) AS isnull;

MySQL has four logic control operators: AND, OR, NOT, and XOR. Three of these operators also have

shorthand notations: && (AND), || (OR), ! (NOT). These shorthand notations should not be confused

with the Bit operators, which are single characters of & and |.

SELECT IF (2 > 1,’2 is greater than 1’,’2 is not greater than 1’) AS answer;

mysql> SET @value=CONVERT(RAND()* 10, UNSIGNED INTEGER);

mysql> SELECT @value,

-> CASE

-> WHEN @value < 3 THEN ‘Value is < 3’

-> WHEN @value > 6 THEN ‘Value is > 6’

-> WHEN @value = 3 OR @value = 6 THEN ‘Value is 3 or 6’

-> ELSE ‘Value is 4 or 5’

-> END;

mysql> SELECT IFNULL(NULL,’Value is NULL’) AS result1,

IFNULL(1 > 2, ‘NULL result’) AS result2;

mysql> CREATE TABLE example (

-> currency ENUM(‘USD’,’CAD’,’AUD’) NOT NULL

-> ) ENGINE=InnoDB DEFAULT CHARSET latin1;

mysql> ALTER TABLE flags

-> ADD FOREIGN KEY (color)

-> REFERENCES colors (color)

-> ON DELETE CASCADE;

mysql> SHOW WARNINGS;

mysql> SET SESSION sql_mode=’TRADITIONAL’;

sql_mode=NO_ENGINE_SUBSTITUTION

SELECT DISTINCT f.color

FROM flags f

WHERE EXISTS

(SELECT 1

FROM colors c

WHERE c.color = f.color);

SELECT DISTINCT f.country,

(SELECT GROUP_CONCAT(color)

FROM flags f2

WHERE f2.country = f.country) AS colors

FROM flags f;

转载地址:http://gtdkx.baihongyu.com/

你可能感兴趣的文章
redux v3.7.2源码解读与学习之 applyMiddleware
查看>>
【React】为什么我不再使用setState?
查看>>
Git原理与高级使用(3)
查看>>
从JDK源码看Writer
查看>>
Express 结合 Webpack 实现HMRwi
查看>>
基于protobuf的RPC实现
查看>>
坚信每个人都能成为品牌
查看>>
JAVA的对象复制
查看>>
打开Office报错
查看>>
我的友情链接
查看>>
AsyncTask简易使用
查看>>
关于PHP sessions的超时设置
查看>>
HAProxy负载均衡原理及企业级实例部署haproxy集群
查看>>
开源中国动弹客户端实践(三)
查看>>
Win 8创造颠覆性体验:预览版关键更新
查看>>
vim在多文件中复制粘贴内容
查看>>
Android ContentObserver
查看>>
文章“关于架构优化和设计,架构师必须知道的事情”
查看>>
疯狂java学习笔记1002---非静态内部类
查看>>
ISA2006实战系列之一:实战ISA三种客户端部署方案(上)
查看>>