国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

mysql中is null語句的用法分享

2024-07-24 12:44:26
字體:
供稿:網(wǎng)友

mysql數(shù)據(jù)庫中is null語句的用法

注意在mysql中,0或 null意味著假而其它值意味著真。布爾運(yùn)算的默認(rèn)真值是1。

對(duì)null的特殊處理即是在前面的章節(jié)中,為了決定哪個(gè)動(dòng)物不再是活著的,使用death is not null而不使用death != null的原因。

在group by中,兩個(gè)null值視為相同。

執(zhí)行order by時(shí),如果運(yùn)行 order by ... asc,則null值出現(xiàn)在最前面,若運(yùn)行order by ... desc,則null值出現(xiàn)在最后面。

null操作的常見錯(cuò)誤是不能在定義為not null的列內(nèi)插入0或空字符串,但事實(shí)并非如此。在null表示"沒有數(shù)值"的地方有數(shù)值

。使用is [not] null則可以很容易地進(jìn)行測(cè)試


is null or = null


mysql>
mysql> create table topic(
    ->    topicid     smallint not null auto_increment primary key,
    ->    name        varchar(50) not null,
    ->    instock     smallint unsigned not null,
    ->    onorder     smallint unsigned not null,
    ->    reserved    smallint unsigned not null,
    ->    department  enum('classical', 'popular') not null,
    ->    category    varchar(20) not null,
    ->    rowupdate   timestamp not null
    -> );
query ok, 0 rows affected (0.02 sec)

mysql>
mysql>
mysql> insert into topic (name,          instock, onorder, reserved, department,   category) values
    ->                   ('java',          10,      5,       3,        'popular',    'rock'),
    ->                   ('css',    10,      5,       3,        'classical',  'opera'),
    ->                   ('c sharp',       17,      4,       1,        'popular',    'jazz'),
    ->                   ('c',             9,       4,       2,        'classical',  'dance'),

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 汉沽区| 长岛县| 宁国市| 泰州市| 宝坻区| 广东省| 宁远县| 台湾省| 天峨县| 大余县| 屏山县| 沙田区| 龙口市| 清河县| 桐乡市| 龙游县| 溧阳市| 大兴区| 同仁县| 兴文县| 讷河市| 柳林县| 斗六市| 南乐县| 耿马| 黔江区| 永和县| 揭东县| 三江| 婺源县| 宣恩县| 八宿县| 泾源县| 和田县| 庆城县| 阳新县| 江西省| 扶绥县| 信宜市| 宜川县| 大宁县|