Sunday, 1 July 2012

CHECK constraint



SQL CHECK constraint

The SQL CHECK constraint bounds/limits the value range that can be placed in a column.

For example, the range of values for a salary column can be limited by creating a CHECK constraint that allows for only data that ranges from $15,000 through $100,000. This prevents salaries from being entered beyond the regular salary range.

Example of SQL CHECK constraint

The following SQL query creates a CHECK constraint on the "Emp_ID" column when the "Employees" table is created. The CHECK constraint specifies that the column "Emp_ID" must only include integers greater than 0.


CREATE TABLE Employees
(
Emp_ID int NOT NULL CHECK (Emp_ID>0),
LastName varchar(255) NOT NULL,
FirstName varchar(255),
Address varchar(255)
)

IE7 Issues Text Indent

                 Unfortunately IE 7 is still widespread among the users hence while theming we have to give special importance to the grea...