Mysql(8)——as和distinct和where的用法

as

as的用法就是给字段或者表起一个别名
在这里插入图片描述
可以发现,我们给basketball_team起了个别名:b,我们就可以用b.来对数据库进行操作。

distinct

当一个字段含有很多相同的内容时,我们可以用distinct来将别的相同信息筛选掉,具体的命令是:
select distinct xx from 你要查询的表;

where

(1)where后面可以跟各种比较运算符和逻辑运算符,>、<、>=、and、or、not。。。
注意:当后面跟null的时候,要写is null/is not null,不能写=null。
(2)where后面还可以跟like,寻找相似的语段,如下:
在这里插入图片描述
(3)where后面还可以跟between和and字段
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_48445640/article/details/108920918