Microsoft Windows [版本 10.0.17134.765]
(c) 2018 Microsoft Corporation。保留所有权利。
--进入mysql
C:\WINDOWS\system32>F:
F:\>cd mysql-8.0.16-winx64\bin
F:\mysql-8.0.16-winx64\bin>mysql -u root -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
--quit
mysql> quit
Bye
F:\mysql-8.0.16-winx64\bin>mysql -u root -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
--exit
mysql> exit
Bye
F:\mysql-8.0.16-winx64\bin>mysql -u root -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
--\c
mysql> SELECT
-> \c
--SELECT VERSION()
mysql> SELECT VERSION()
-> ;
+-----------+
| VERSION() |
+-----------+
| 8.0.16 |
+-----------+
1 row in set (0.35 sec)
--SELECT USER();
mysql> SELECT USER();
+----------------+
| USER() |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)
--SHOW DATABASES;
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| menagerie |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
6 rows in set (0.43 sec)
--USE database_name;
mysql> USE menagerie;
Database changed
mysql> SHOW TABLES;
+---------------------+
| Tables_in_menagerie |
+---------------------+
| pet |
+---------------------+
1 row in set (0.43 sec)
--DESCRIBE table_name;
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| owner | varchar(20) | YES | | NULL | |
| species | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
6 rows in set (0.01 sec)
--DELETE FROM table_name;
mysql> DELETE FROM pet;
Query OK, 15 rows affected (0.57 sec)
--SHOW TABLES;
mysql> SHOW TABLES;
+---------------------+
| Tables_in_menagerie |
+---------------------+
| pet |
+---------------------+
1 row in set (0.00 sec)
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| owner | varchar(20) | YES | | NULL | |
| species | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
--SELECT
mysql> SELECT * FROM pet;
Empty set (0.00 sec)
--DROP TABLE table_name;
mysql> DROP TABLE pet;
Query OK, 0 rows affected (0.70 sec)
mysql> SHOW TABLES;
Empty set (0.00 sec)
--DROP DATABASE database_name;
mysql> DROP DATABASE menagerie;
Query OK, 0 rows affected (0.27 sec)
mysql> SHOW DATABASES;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| test |
+--------------------+
5 rows in set (0.00 sec)
mysql> USE test;
Database changed
mysql> SHOW TABLES;
+----------------+
| Tables_in_test |
+----------------+
| runoob_tbl |
+----------------+
1 row in set (0.00 sec)
mysql> SELECT runoob_tbl;
ERROR 1054 (42S22): Unknown column 'runoob_tbl' in 'field list'
mysql> SELECT * FROM runoob_tbl;
+-----------+--------------+---------------+-----------------+
| runoob_id | runoob_title | runoob_author | submission_date |
+-----------+--------------+---------------+-----------------+
| 1 | 学习PHP | 菜鸟教程 | 2019-06-03 |
| 2 | 学习MYSQL | 菜鸟教程 | 2019-06-03 |
| 3 | JAVA教程 | 菜鸟教程 | 2019-06-03 |
+-----------+--------------+---------------+-----------------+
3 rows in set (0.41 sec)
--CREATE DATABASE new_database_name;
mysql> CREATE DATABASE zoo;
Query OK, 1 row affected (0.39 sec)
mysql> USE zoo;
Database changed
--CREATE TABLE new_table_name(filed type, filed type);
mysql> CREATE TABLE pet
-> (name VARCHAR(20),
-> owner VARCHAR(20),
-> species varchar(20),
-> sex char(1),
-> birth DATE,
-> death DATE);
Query OK, 0 rows affected (0.66 sec)
mysql> DESCRIBE pet;
+---------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+-------+
| name | varchar(20) | YES | | NULL | |
| owner | varchar(20) | YES | | NULL | |
| species | varchar(20) | YES | | NULL | |
| sex | char(1) | YES | | NULL | |
| birth | date | YES | | NULL | |
| death | date | YES | | NULL | |
+---------+-------------+------+-----+---------+-------+
6 rows in set (0.00 sec)
mysql> LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet LINES TERMINATED BY '\r\n';
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql> LOAD DATA LOCAL INFILE 'F:/mysql-8.0.16-winx64/pet.txt' INTO TABLE pet LINES TERMINATED BY '\r\n';
ERROR 1148 (42000): The used command is not allowed with this MySQL version
mysql> quit
Bye
--不知为何参数并没有成功改为1,后面有查看方法和另一种改变方法
F:\mysql-8.0.16-winx64\bin>mysql --local-infile=1 -u root -p
Enter password: ***********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 8.0.16 MySQL Community Server - GPL
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> USE zoo;
Database changed
mysql> LOAD DATA LOCAL INFILE 'F:/mysql-8.0.16-winx64/pet.txt' INTO TABLE pet LINES TERMINATED BY '\r\n';
ERROR 1148 (42000): The used command is not allowed with this MySQL version
--SHOW ERRORS;
mysql> SHOW ERRORS;
+-------+------+---------------------------------------------------------+
| Level | Code | Message |
+-------+------+---------------------------------------------------------+
| Error | 1148 | The used command is not allowed with this MySQL version |
+-------+------+---------------------------------------------------------+
1 row in set (0.00 sec)
--查看变量值
--SHOW GLABOL VARIABLES LIKE 'xxxx';
mysql> show global variables like 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | OFF |
+---------------+-------+
1 row in set, 1 warning (0.00 sec)
--设置变量值
--SET GLOBAL xxxx = 'on';
mysql> set global local_infile = 'ON';
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like 'local_infile';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| local_infile | ON |
+---------------+-------+
1 row in set, 1 warning (0.00 sec)
--成功载入
mysql> LOAD DATA LOCAL INFILE 'F:/mysql-8.0.16-winx64/pet.txt' INTO TABLE pet LINES TERMINATED BY '\r\n';
Query OK, 7 rows affected (0.38 sec)
Records: 7 Deleted: 0 Skipped: 0 Warnings: 0
mysql> SELECT * FROM pet;
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Fluffy | Harold | cat | f | 1933-02-04 | NULL |
| Claws | Gwen | dog | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Chirpy | Gwen | bird | NULL | 1997-12-09 | NULL |
| Whistler | Gwen | snake | m | 1996-04-29 | NULL |
+----------+--------+---------+------+------------+------------+
7 rows in set (0.00 sec)
--插入
mysql> INSERT INTO pet VALUES('Puffball', 'Diane', 'hamster', 'f', '1999-03-30',NULL);
Query OK, 1 row affected (0.38 sec)
--SELECT * FROM table_name;
mysql> SELECT * FROM pet;
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Fluffy | Harold | cat | f | 1933-02-04 | NULL |
| Claws | Gwen | dog | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Chirpy | Gwen | bird | NULL | 1997-12-09 | NULL |
| Whistler | Gwen | snake | m | 1996-04-29 | NULL |
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
+----------+--------+---------+------+------------+------------+
8 rows in set (0.00 sec)
--SELECT * FROM table_name WHERE conditions;
mysql> SELECT * FROM pet WHERE name = 'Bowser';
+--------+-------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+--------+-------+---------+------+------------+------------+
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
+--------+-------+---------+------+------------+------------+
1 row in set (0.00 sec)
--注意,日期的表示要加'',从结果可见,这是无效的筛选
mysql> SELECT * FROM pet WHERE birth > 1970-01-01;
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Fluffy | Harold | cat | f | 1933-02-04 | NULL |
| Claws | Gwen | dog | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Chirpy | Gwen | bird | NULL | 1997-12-09 | NULL |
| Whistler | Gwen | snake | m | 1996-04-29 | NULL |
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
+----------+--------+---------+------+------------+------------+
8 rows in set, 1 warning (0.00 sec)
--SHOW WARNINGS;
mysql> SHOW WARNINGS;
+---------+------+----------------------------------------------------------+
| Level | Code | Message |
+---------+------+----------------------------------------------------------+
| Warning | 1292 | Incorrect date value: '1968' for column 'birth' at row 1 |
+---------+------+----------------------------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT * FROM pet WHERE birth > '1970-01-01';
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Claws | Gwen | dog | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Chirpy | Gwen | bird | NULL | 1997-12-09 | NULL |
| Whistler | Gwen | snake | m | 1996-04-29 | NULL |
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
+----------+--------+---------+------+------------+------------+
7 rows in set (0.00 sec)
--SELECT filed FROM table_name;
mysql> SELECT owner FROM pet;
+--------+
| owner |
+--------+
| Harold |
| Gwen |
| Harold |
| Benny |
| Diane |
| Gwen |
| Gwen |
| Diane |
+--------+
8 rows in set (0.00 sec)
--DISTINCT
mysql> select distinct owner from pet;
+--------+
| owner |
+--------+
| Harold |
| Gwen |
| Benny |
| Diane |
+--------+
4 rows in set (0.01 sec)
--AND
mysql> SELECT * FROM pet WHERE species = 'dog' AND sex = 'f';
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth | death |
+-------+--------+---------+------+------------+-------+
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
1 row in set (0.00 sec)
--OR
mysql> SELECT * FROM pet WHERE species = 'dog' OR sex = 'f';
+----------+--------+---------+------+------------+------------+
| name | owner | species | sex | birth | death |
+----------+--------+---------+------+------------+------------+
| Fluffy | Harold | cat | f | 1933-02-04 | NULL |
| Claws | Gwen | dog | m | 1994-03-17 | NULL |
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
| Fang | Benny | dog | m | 1990-08-27 | NULL |
| Bowser | Diane | dog | m | 1979-08-31 | 1995-07-29 |
| Puffball | Diane | hamster | f | 1999-03-30 | NULL |
+----------+--------+---------+------+------------+------------+
6 rows in set (0.00 sec)
--()
mysql> SELECT * FROM pet WHERE(species = 'cat' AND sex = 'm')OR(species = 'dog' AND sex = 'f');
+-------+--------+---------+------+------------+-------+
| name | owner | species | sex | birth | death |
+-------+--------+---------+------+------------+-------+
| Buffy | Harold | dog | f | 1989-05-13 | NULL |
+-------+--------+---------+------+------------+-------+
1 row in set (0.00 sec)
mysql> SELECT name, sex FROM pet;
+----------+------+
| name | sex |
+----------+------+
| Fluffy | f |
| Claws | m |
| Buffy | f |
| Fang | m |
| Bowser | m |
| Chirpy | NULL |
| Whistler | m |
| Puffball | f |
+----------+------+
8 rows in set (0.00 sec)
--ORDER BY
mysql> SELECT name, owner, birth FROM pet ORDER BY birth;
+----------+--------+------------+
| name | owner | birth |
+----------+--------+------------+
| Fluffy | Harold | 1933-02-04 |
| Bowser | Diane | 1979-08-31 |
| Buffy | Harold | 1989-05-13 |
| Fang | Benny | 1990-08-27 |
| Claws | Gwen | 1994-03-17 |
| Whistler | Gwen | 1996-04-29 |
| Chirpy | Gwen | 1997-12-09 |
| Puffball | Diane | 1999-03-30 |
+----------+--------+------------+
8 rows in set (0.00 sec)
mysql> SELECT name, owner, birth FROM pet ORDER BY name;
+----------+--------+------------+
| name | owner | birth |
+----------+--------+------------+
| Bowser | Diane | 1979-08-31 |
| Buffy | Harold | 1989-05-13 |
| Chirpy | Gwen | 1997-12-09 |
| Claws | Gwen | 1994-03-17 |
| Fang | Benny | 1990-08-27 |
| Fluffy | Harold | 1933-02-04 |
| Puffball | Diane | 1999-03-30 |
| Whistler | Gwen | 1996-04-29 |
+----------+--------+------------+
8 rows in set (0.00 sec)
--DESC
mysql> SELECT name, owner, birth FROM pet ORDER BY birth DESC;
+----------+--------+------------+
| name | owner | birth |
+----------+--------+------------+
| Puffball | Diane | 1999-03-30 |
| Chirpy | Gwen | 1997-12-09 |
| Whistler | Gwen | 1996-04-29 |
| Claws | Gwen | 1994-03-17 |
| Fang | Benny | 1990-08-27 |
| Buffy | Harold | 1989-05-13 |
| Bowser | Diane | 1979-08-31 |
| Fluffy | Harold | 1933-02-04 |
+----------+--------+------------+
8 rows in set (0.00 sec)
--ORDER BY多个属性、多个方向
mysql> SELECT name, owner, species,birth FROM pet ORDER BY species, birth DESC;
+----------+--------+---------+------------+
| name | owner | species | birth |
+----------+--------+---------+------------+
| Chirpy | Gwen | bird | 1997-12-09 |
| Fluffy | Harold | cat | 1933-02-04 |
| Claws | Gwen | dog | 1994-03-17 |
| Fang | Benny | dog | 1990-08-27 |
| Buffy | Harold | dog | 1989-05-13 |
| Bowser | Diane | dog | 1979-08-31 |
| Puffball | Diane | hamster | 1999-03-30 |
| Whistler | Gwen | snake | 1996-04-29 |
+----------+--------+---------+------------+
8 rows in set (0.00 sec)
--AS别名
mysql> SELECT species AS animals FROM pet;
+---------+
| animals |
+---------+
| cat |
| dog |
| dog |
| dog |
| dog |
| bird |
| snake |
| hamster |
+---------+
8 rows in set (0.00 sec)
--CURDATE()
--NOW(),CURDATE(), CURTIME()
mysql> SELECT NOW(), CURDATE(), CURTIME();
+---------------------+------------+-----------+
| NOW() | CURDATE() | CURTIME() |
+---------------------+------------+-----------+
| 2019-06-06 11:24:31 | 2019-06-06 | 11:24:31 |
+---------------------+------------+-----------+
1 row in set (0.00 sec)
--TIME(), DATE()
mysql> SELECT TIME(NOW()),DATE(NOW());
+-------------+-------------+
| TIME(NOW()) | DATE(NOW()) |
+-------------+-------------+
| 11:24:58 | 2019-06-06 |
+-------------+-------------+
1 row in set (0.00 sec)
--YEAR()
mysql> SELECT YEAR(CURDATE());
+-----------------+
| YEAR(CURDATE()) |
+-----------------+
| 2019 |
+-----------------+
1 row in set (0.00 sec)
--MONTH()
mysql> SELECT MONTH(CURDATE());
+------------------+
| MONTH(CURDATE()) |
+------------------+
| 6 |
+------------------+
1 row in set (0.00 sec)
--DAY()
mysql> select DAY(CURDATE());
+----------------+
| DAY(CURDATE()) |
+----------------+
| 6 |
+----------------+
1 row in set (0.00 sec)
--DAYOFMONTH()
mysql> SELECT DAYOFMONTH(CURDATE());
+-----------------------+
| DAYOFMONTH(CURDATE()) |
+-----------------------+
| 6 |
+-----------------------+
1 row in set (0.00 sec)
--DAYOFWEEK()
mysql> SELECT DAYOFWEEK(CURDATE());
+----------------------+
| DAYOFWEEK(CURDATE()) |
+----------------------+
| 5 |
+----------------------+
1 row in set (0.00 sec)
--HOUR(), MINUTE(), SECOND()
mysql> SELECT HOUR(CURTIME()), MINUTE(CURTIME()), SECOND(CURTIME());
+-----------------+-------------------+-------------------+
| HOUR(CURTIME()) | MINUTE(CURTIME()) | SECOND(CURTIME()) |
+-----------------+-------------------+-------------------+
| 11 | 24 | 16 |
+-----------------+-------------------+-------------------+
1 row in set (0.00 sec)
--DATEDIFF()
mysql> SELECT DATEDIFF('1999-01-02', CURDATE());
+-----------------------------------+
| DATEDIFF('1999-01-02', CURDATE()) |
+-----------------------------------+
| -7460 |
+-----------------------------------+
1 row in set (0.00 sec)
mysql> SELECT DATEDIFF('1999-01-02', '1999-01-05');
+--------------------------------------+
| DATEDIFF('1999-01-02', '1999-01-05') |
+--------------------------------------+
| -3 |
+--------------------------------------+
1 row in set (0.00 sec)
--ADDDATE()
mysql> SELECT ADDDATE(CURDATE(), INTERVAL 1 DAY);
+------------------------------------+
| ADDDATE(CURDATE(), INTERVAL 1 DAY) |
+------------------------------------+
| 2019-06-07 |
+------------------------------------+
1 row in set (0.00 sec)
mysql> SELECT DATE_FORMAT(CURDATE());
ERROR 1582 (42000): Incorrect parameter count in the call to native function 'DATE_FORMAT'
--INTERVAL
mysql> SELECT NOW()+ INTERVAL 1 MONTH;
+-------------------------+
| NOW()+ INTERVAL 1 MONTH |
+-------------------------+
| 2019-07-06 11:28:27 |
+-------------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW()+ INTERVAL 1 HOUR;
+------------------------+
| NOW()+ INTERVAL 1 HOUR |
+------------------------+
| 2019-06-06 12:28:34 |
+------------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW()+ INTERVAL 1 YEAR;
+------------------------+
| NOW()+ INTERVAL 1 YEAR |
+------------------------+
| 2020-06-06 11:28:42 |
+------------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW()+ INTERVAL 1 DAY;
+-----------------------+
| NOW()+ INTERVAL 1 DAY |
+-----------------------+
| 2019-06-07 11:28:50 |
+-----------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW()+ INTERVAL 1 MINUTE;
+--------------------------+
| NOW()+ INTERVAL 1 MINUTE |
+--------------------------+
| 2019-06-06 11:29:55 |
+--------------------------+
1 row in set (0.00 sec)
mysql> SELECT NOW()+ INTERVAL 100 SECOND;
+----------------------------+
| NOW()+ INTERVAL 100 SECOND |
+----------------------------+
| 2019-06-06 11:30:44 |
+----------------------------+
1 row in set (0.00 sec)
--SIN(), COS(), TAN()
--ABS(), SQRT(), MOD(), EXP(), PI(), RAND()
mysql> SELECT SIN(1), COS(1), TAN(1), ABS(-1),SQRT(4),MOD(12,5),EXP(2),PI(), RAND();
+--------------------+--------------------+--------------------+---------+---------+-----------+------------------+----------+--------------------+
| SIN(1) | COS(1) | TAN(1) | ABS(-1) | SQRT(4) | MOD(12,5) | EXP(2) | PI() | RAND() |
+--------------------+--------------------+--------------------+---------+---------+-----------+------------------+----------+--------------------+
| 0.8414709848078965 | 0.5403023058681398 | 1.5574077246549023 | 1 | 2 | 2 | 7.38905609893065 | 3.141593 | 0.7676350770216762 |
+--------------------+--------------------+--------------------+---------+---------+-----------+------------------+----------+--------------------+
1 row in set (0.00 sec)
--NULL
mysql> SELECT 1 IS NULL, 0 IS NOT Null, ' ' IS NULL;
+-----------+---------------+-------------+
| 1 IS NULL | 0 IS NOT Null | ' ' IS NULL |
+-----------+---------------+-------------+
| 0 | 1 | 0 |
+-----------+---------------+-------------+
1 row in set (0.00 sec)
mysql> SELECT 1 = NULL, 1<>NULL, 1<NULL, 1>NULL;
+----------+---------+--------+--------+
| 1 = NULL | 1<>NULL | 1<NULL | 1>NULL |
+----------+---------+--------+--------+
| NULL | NULL | NULL | NULL |
+----------+---------+--------+--------+
1 row in set (0.00 sec)