Home  >  Article  >  Backend Development  >  Related knowledge about SQL NOT NULL constraints

Related knowledge about SQL NOT NULL constraints

jacklove
jackloveOriginal
2018-05-08 10:34:351722browse

SQL NOT NULL constraints are very important in PHP. This article will explain its related knowledge.

SQL NOT NULL Constraints

NOT NULL constraints force columns not to accept NULL values.

NOT NULL constraint forces the field to always contain a value. This means that you cannot insert a new record or update a record without adding a value to the field.

The following SQL statement forces the "Id_P" column and the "LastName" column not to accept NULL values:

CREATE TABLE Persons
(
Id_P int NOT NULL,
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255),
City varchar(255)
)

This article provides relevant explanations of constraint-related knowledge, and more learning materials Please pay attention to php Chinese website to watch.

Related recommendations:

How to use the SQL CREATE TABLE statement

Understand the relevant knowledge of the SQL INNER JOIN keyword

Related knowledge about SQL JOIN


The above is the detailed content of Related knowledge about SQL NOT NULL constraints. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn