SQL CONSTRAINT



  SQL > Table Manipulation > Constraint

You can place constraints to limit the type of data that can go into a table. Such constraints can be specified when the table when the table is first created via the CREATE TABLE statement, or after the table is already created via the ALTER TABLE statement.

Common types of constraints include the following:

  • NOT NULL Constraint: Ensures that a column cannot have NULL value.
  • DEFAULT Constraint: Provides a default value for a column when none is specified.
  • UNIQUE Constraint: Ensures that all values in a column are different.
  • CHECK Constraint: Makes sure that all values in a column satisfy certain criteria.
  • Primary Key Constraint: Used to uniquely identify a row in the table.
  • Foreign Key Constraint: Used to ensure referential integrity of the data.
  • Each constraint is discussed in the following sections.

    Next: SQL NOT NULL




    Copyright © 2013 1keydata.com   All Rights Reserved.     Privacy Policy


    SQL SELECT
    SQL DISTINCT
    SQL WHERE
    SQL AND OR
    SQL IN
    SQL BETWEEN
    SQL Wildcard
    SQL LIKE
    SQL ORDER BY
    SQL Functions
    SQL Average
    SQL COUNT
    SQL MAX
    SQL MIN
    SQL SUM
    SQL GROUP BY
    SQL HAVING
    SQL ALIAS
    SQL AS
    SQL JOIN
    SQL INNER JOIN
    SQL OUTER JOIN
    SQL LEFT OUTER JOIN
    SQL CROSS JOIN
    SQL SELECT UNIQUE
    SQL ROUND
    SQL CAST
    SQL CONVERT
    SQL CONCATENATE
    SQL SUBSTRING
    SQL INSTR
    SQL TRIM
    SQL LENGTH
    SQL REPLACE
    SQL DATEADD
    SQL DATEDIFF
    SQL DATEPART
    SQL GETDATE
    SQL SYSDATE

    SQL CREATE TABLE
    SQL Data Types
    SQL CONSTRAINT
    SQL NOT NULL
    SQL DEFAULT
    SQL UNIQUE
    SQL CHECK
    PRIMARY KEY
    FOREIGN KEY
    SQL View
    SQL CREATE VIEW
    SQL Index
    SQL CREATE INDEX
    SQL ALTER TABLE
    SQL DROP TABLE
    SQL TRUNCATE TABLE
    SQL USE
    SQL CREATE DATABASE
    SQL DROP DATABASE
    SQL INSERT INTO
    SQL INSERT INTO SELECT
    SQL UPDATE
    SQL DELETE FROM

    SQL Video Tutorial
    SQL Jobs

    Site Map
    Resources