Oracle Add, modify non-null constraints

Source: Internet
Author: User

A NOT NULL constraint is a non-null constraint that often adds a non-null constraint when creating a table to guarantee that the field must enter a value

(1) Add NOT NULL constraint when creating table

Grammar:

CREATE Table table name (field type not NULL ...);

Instance:

CREATE TABLE Managerinfo (ManagerID VARCHAR2 (Ten), LOGINNAME VARCHAR2 (Ten) not Null,password VARCHAR2 (Ten) not null,name VARCHAR2 (+), TEL VARCHAR2 (11));

(2) Adding a non-empty constraint using alter

Grammar:

ALTER table name modify column not NULL;

Instance:

--use ALTER to add a non-empty constraint to the Name column

ALTER TABLE managerinfo MODIFY NAME not NULL;

(3) non-null constraint deletion

Simply change the column to null using the non-empty modify

Grammar:

ALTER Table name Modify column NULL;

Instance:

--use ALTER to change the name to a null value

ALTER TABLE managerinfo MODIFY NAME NULL;



This article is from the "Loly_zhang" blog, make sure to keep this source http://lolyzhang.blog.51cto.com/10029387/1889863

Oracle Add, modify non-null constraints

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.