我有一张这样的表:
+---------+---------+-----------------------------------------+
| type | city | name |
+---------+---------+-----------------------------------------+
| cricket | kolkata | Khadim's Ashok Malhotra Cricket Academy |
| cricket | kolkata | Calcutta Cricket Coaching Center (C4) |
| cricket | kolkata | Sambaran Banerjee Cricket academy |
| cricket | kolkata | Bournvita cricket acadamemy of arun lal |
| cricket | kolkata | friends of the stadium |
| cricket | kolkata | pankaj roy cricket academy |
| cricket | kolkata | sunil gavaskar cricket foundation |
| cricket | kolkata | castlewood india |
| cricket | kolkata | GK sports |
| cricket | kolkata | NULL |
| cricket | kolkata | NULL |
| cricket | kolkata | NULL |
| cricket | kolkata | NULL |
| cricket | kolkata | NULL |
| cricket | kolkata | NULL |
+---------+---------+-----------------------------------------+
我想提供不同的名称而不是NULL
,我该怎么做?
答案 0 :(得分:0)
尝试IFNULL
Select IFNULL(name,'Jon Smith') as name from myTable
如果您希望在名称中的值为null时使用该研究所的名称 你可以::
Select IFNULL(name,institute) as name from myTable
答案 1 :(得分:0)
您也可以使用它:
从name
select * from table_name where name like "Cricket%"
包含任何
select * from table_name where name like "%Cricket%"
以
结尾select * from table_name where name like "%Cricket"