×ðÁú¿­Ê±

sqlÖв»¼´ÊÇ¿ÕÔõôÌåÏÖ

sql Öв»¼´ÊÇ¿ÕµÄд·¨ÓÐÁ½ÖÖ£º1. is not null£»2. ”¡£Ê¹Óà is not null ÅÌÎʽ«·µ»ØÁв»Îª null µÄ¼Í¼£¬¶øʹÓà ” ÅÌÎʽ«·µ»ØÁв»¼´ÊÇ¿Õ×Ö·û´®µÄ¼Í¼¡£

SQL ÖÐÌåÏÖ²»¼´ÊÇ¿ÕµÄд·¨

ÔÚ SQL ÖУ¬²»¼´ÊÇ¿Õ¿ÉÒÔʹÓÃÒÔÏÂÁ½ÖÖÖ÷Òª·½·¨ÌåÏÖ£º

1. IS NOT NULL

SELECT * FROM table_name WHERE column_name IS NOT NULL;

µÇ¼ºó¸´ÖÆ

´ËÅÌÎʽ«·µ»Ø±íÖÐ column_name Áв»Îª NULL µÄËùÓмͼ¡£

2. ”

SELECT * FROM table_name WHERE column_name  '';

µÇ¼ºó¸´ÖÆ

´ËÅÌÎʽ«·µ»Ø±íÖÐ column_name Áв»¼´ÊÇ¿Õ×Ö·û´®µÄ¼Í¼¡£

ʾÀý

ʹÓÃʾÀý±í£º

CREATE TABLE table_name (
  id INT NOT NULL,
  name VARCHAR(255)
);

µÇ¼ºó¸´ÖÆ

²åÈëһЩ¼Í¼£º

INSERT INTO table_name (id, name) VALUES (1, 'John Doe');
INSERT INTO table_name (id, name) VALUES (2, NULL);

µÇ¼ºó¸´ÖÆ

ʹÓà IS NOT NULL ÅÌÎÊ

SELECT * FROM table_name WHERE name IS NOT NULL;

µÇ¼ºó¸´ÖÆ

Ч¹û£º

+----+------+
| id | name  |
+----+------+
| 1  | John Doe |
+----+------+

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ʹÓà ” ÅÌÎÊ

SELECT * FROM table_name WHERE name  '';

µÇ¼ºó¸´ÖÆ

Ч¹û£º

+----+------+
| id | name  |
+----+------+
| 1  | John Doe |
+----+------+

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

ÒÔÉϾÍÊÇsqlÖв»¼´ÊÇ¿ÕÔõôÌåÏÖµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

13452372176

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿