Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
SQL NOT NULL Constraint 
 

The NOT NULL constraint allows a column not to accept NULL values. This specify that NOT NULL Constraint enforce the field to accept a value.

 

SQL NOT NULL Constraint

                         

The NOT NULL constraint allows a column not to accept NULL values. This specify that NOT NULL Constraint enforce the field to accept a value. Simply, neither you insert or update a new record without  adding a value to this field.

Understand with Example

The Tutorial illustrates an example from 'SQL NOT NULL Constraint'. In this example, we create a table Stu_Class_10 with the help of create statement. When you create a table ,we define a field attribute, data type, null value etc. The following SQL enforces the Columns "Stu_Id","Stu_Name" and "Stu_Class" column not to accept NULL values. The insert into adds the records value into table'Stu_Class_10'.The select statement show you the records from table 'Stu_Class_10'.When you do not insert any value to record ,the records shows you SQL NOT NULL Constraint.

Create Table Stu_Class_10

CREATE TABLE Stu_Class_10(
Stu_Id integer(2) NOT NULL, 
Stu_Name varchar(15) NOT NULL, 
Stu_Class  varchar(10)) NOT NULL)

Insert data into Stu_Class_10 table

insert into Stu_Class_10 values(1,'Komal',10);
insert into Stu_Class_10 values(2,'Ajay',10);
insert into Stu_Class_10 values(3,'Rakesh',10);
insert into Stu_Class_10 values(4,'Bhanu',10);
insert into Stu_Class_10 values(5,'Santosh',10);

Stu_Class_10

Stu_Id Stu_Name Stu_Class
1 Komal 10
2 Ajay 10
3 Rakesh 10
4 Bhanu 10
5 Santosh 10

                         

» View all related tutorials
Related Tags: sql mysql string io sed return this id position for with to dst pos e it synonym ids use in

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.