MySQL学习笔记六
2022/2/3 19:12:44
本文主要是介绍MySQL学习笔记六,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
MySQL学习笔记六
文章目录
- MySQL学习笔记六
- 一、简介
- 二、MySQL NULL 值处理
- 三、MySQL 正则表达式
- 四、总结
一、简介
时隔多日没有学习MySQL数据库了,今天重新开始继续学习MySQL数据库的有关内容,并重新开启MySQL的新的征程。
二、MySQL NULL 值处理
MySQL NULL 值处理
root@host# mysql -u root -p password; Enter password:******* mysql> use RUNOOB; Database changed mysql> create table runoob_test_tbl -> ( -> runoob_author varchar(40) NOT NULL, -> runoob_count INT -> ); Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('RUNOOB', 20); mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('菜鸟教程', NULL); mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('Google', NULL); mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('FK', 20); mysql> SELECT * from runoob_test_tbl; +---------------+--------------+ | runoob_author | runoob_count | +---------------+--------------+ | RUNOOB | 20 | | 菜鸟教程 | NULL | | Google | NULL | | FK | 20 | +---------------+--------------+ 4 rows in set (0.01 sec)
root@host# mysql -u root -p password; Enter password:******* mysql> use RUNOOB; Database changed mysql> create table runoob_test_tbl -> ( -> runoob_author varchar(40) NOT NULL, -> runoob_count INT -> ); Query OK, 0 rows affected (0.05 sec) mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('RUNOOB', 20); mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('菜鸟教程', NULL); mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('Google', NULL); mysql> INSERT INTO runoob_test_tbl (runoob_author, runoob_count) values ('FK', 20); mysql> SELECT * from runoob_test_tbl; +---------------+--------------+ | runoob_author | runoob_count | +---------------+--------------+ | RUNOOB | 20 | | 菜鸟教程 | NULL | | Google | NULL | | FK | 20 | +---------------+--------------+ 4 rows in set (0.01 sec)
mysql> SELECT * FROM runoob_test_tbl WHERE runoob_count = NULL; Empty set (0.00 sec) mysql> SELECT * FROM runoob_test_tbl WHERE runoob_count != NULL; Empty set (0.01 sec)
mysql> SELECT * FROM runoob_test_tbl WHERE runoob_count IS NULL; +---------------+--------------+ | runoob_author | runoob_count | +---------------+--------------+ | 菜鸟教程 | NULL | | Google | NULL | +---------------+--------------+ 2 rows in set (0.01 sec) mysql> SELECT * from runoob_test_tbl WHERE runoob_count IS NOT NULL; +---------------+--------------+ | runoob_author | runoob_count | +---------------+--------------+ | RUNOOB | 20 | | FK | 20 | +---------------+--------------+ 2 rows in set (0.01 sec)
三、MySQL 正则表达式
MySQL 正则表达式
MySQL 正则表达式
mysql> SELECT name FROM person_tbl WHERE name REGEXP '^st';
mysql> SELECT name FROM person_tbl WHERE name REGEXP 'ok$';
mysql> SELECT name FROM person_tbl WHERE name REGEXP 'mar';
mysql> SELECT name FROM person_tbl WHERE name REGEXP '^[aeiou]|ok$';
四、总结
以上就是一些有关Mysql的知识,后续还会继续更新的,谢谢大家的阅读与支持了啦,期待大家的持续的支持了啦。
这篇关于MySQL学习笔记六的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-16MySQL资料:新手入门教程
- 2024-11-16MySQL资料:新手入门教程
- 2024-11-15MySQL教程:初学者必备的MySQL数据库入门指南
- 2024-11-15MySQL教程:初学者必看的MySQL入门指南
- 2024-11-04部署MySQL集群项目实战:新手入门教程
- 2024-11-04如何部署MySQL集群资料:新手入门指南
- 2024-11-02MySQL集群项目实战:新手入门指南
- 2024-11-02初学者指南:部署MySQL集群资料
- 2024-11-01部署MySQL集群教程:新手入门指南
- 2024-11-01如何部署MySQL集群:新手入门教程