
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
What are MySQL constraints?
As we know that constraint is a kind of limitation or restriction. Similarly, MySQL constraints are used to define some rules that limit the data that can go into a table. With the help of constraints, we can basically maintain the accuracy and integrity of the data inside the table.
Types of MySQL constraints
MySQL constraints are of two types −
- Column Level constraints − The constraints which are applied only to a particular column of the table and limits only column data are called column level constraints.
- Table Level constraints − The constraints which are applied to the whole table and limits whole table data are called table-level constraints.
Followings are some most common MySQL constraints −
- NOT NULL
- UNIQUE
- PRIMARY KEY
- FOREIGN KEY
- CHECK
- DEFAULT
- Related Articles
- How MySQL Deals with Constraints?
- What are constraints on ER model in DBMS?
- What are the methods for Clustering with Constraints?
- What are integrity constraints over the relation in DBMS?
- What are the Categorization of Constraints in data mining?
- Show constraints on table command in MySQL?
- Get a list of Constraints from MySQL Database?
- Get a list of Foreign Key constraints in MySQL
- How to display all constraints on a table in MySQL?
- How do I show unique constraints of a table in MySQL?
- sp_help for MySQL to display field types and foreign key constraints?
- Constraints on Generalization
- Constraints in DBMS
- What are MySQL joins?
- What all constraints can be added to a PostgreSQL table?

Advertisements