Điều Kiện IS NOT NULL Trong SQL - Deft Blog
Điều kiện IS NOT NULL trong SQL được sử dụng để chỉ ra một điều kiện rằng giá trị của một cột phải khác null.
Giá trị NULL trong một bảng là một giá trị trong trường thông tin bị bỏ trống, hay nói cách khác, một trường không có giá trị nào.
Cú pháp
column IS NOT NULLTên biến hoặc giá trị biến
Lưu ý
- Cột có giá trị NOT NULL được trả về kết quả là TRUE
- Cột có giá trị NULL được trả về kết quả là FALSE
Ví dụ – lệnh SELECT
Ví dụ điều kiện IS NOT NULL trong lệnh SELECT trong SQL.
SELECT * FROM nhanvien WHERE ho IS NOT NULL;Ví dụ này trả về tất cả các bản ghi từ bảng nhanvien có mà trường thông tin họ nhân viên không chứa giá trị NULL (không bị bỏ trống).
INSERT INTO danhba (danhba_id, ho, ten) SELECT nhanvien_id, ho, ten FROM nhanvien WHERE ho IS NOT NULL;Lệnh này sẽ sao chép các bạn ghi có tên khác null từ bảng nhanvien sang bảng danhba.
UPDATE nhanvien SET tinhtrang = ‘Active’ WHERE ho IS NOT NULL;Các bản ghi trong bảng nhanvien mà có họ không phải là giá trị NULL sẽ được cập nhật
DELETE FROM nhanvien WHERE tinhtrang IS NOT NULL;Ở ví dụ này, tất cả bản ghi từ bảng nhanvien có trường thông tin “tình trạng” không chứa giá trị NULL sẽ bị xóa.
Prev Article Next Article 0 0 votes Article Rating Subscribe Login Notify of new follow-up comments new replies to my comments

Bài viết liên quan
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More
In case of sale of your personal information, you may opt out by using the link Do Not Sell My Personal Information
Accept Decline Cookie Settings I consent to the use of following cookies: Necessary Marketing Analytics Preferences Unclassified Cookie Declaration About Cookies Necessary (0) Marketing (0) Analytics (0) Preferences (0) Unclassified (0) Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies. We do not use cookies of this type. Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers. We do not use cookies of this type. Analytics cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously. We do not use cookies of this type. Preference cookies enable a website to remember information that changes the way the website behaves or looks, like your preferred language or the region that you are in. We do not use cookies of this type. Unclassified cookies are cookies that we are in the process of classifying, together with the providers of individual cookies. We do not use cookies of this type. Cookies are small text files that can be used by websites to make a user's experience more efficient. The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages. Cookie SettingsDo you really wish to opt-out? Close
Cancel Confirm wpDiscuz0Would love your thoughts, please comment.x()x| ReplyInsertTừ khóa » Not Null Là Gì
-
Hướng Dẫn Tìm Hiểu Về NULL Và NOT NULL Trong MySQL
-
Giá Trị NULL Trong SQL
-
(NOT NULL) Không Cho Phép Nhận Giá Trị NULL Trong MySQL
-
Cách Sử Dụng Ràng Buộc NOT NULL Trong SQL
-
(Not Null) Không Cho Phép Nhận Giá Trị Null Là Gì, Giá Trị Null ...
-
SQL Server: NULL Và NOT NULL | V1Study
-
[MySQL 17] Giá Trị NULL Và NOT NULL - Code Lean
-
Ràng Buộc NOT NULL Trong SQL Server - Comdy
-
Is Not Null Là Gì
-
Ràng Buộc NOT NULL - Hoclaptrinh
-
Ràng Buộc NOT NULL Trong SQL
-
Not NULL Trong SQL Là Gì - Hỏi Đáp
-
Giá Trị NULL Trong MySQL - Học MySQL Online - Viettuts
-
Ý Nghĩa Của NULL Trong SQL - Deft Blog