SQL Constraints

Advertisements

SQL Update Command Primary Key in SQL

SQL Constraints

Constraints is a mechanism which is used to stop or Restrict invalid data which is entered by the end user.

constraints

We can apply the constraints in two situations

  • During creation of table
  • After creation of table

We can apply the constraints in two level on the table.

  • Column level constraints
  • Table level constraints

Column level constraints

Applying the constraints after defined the column immediately than those constraints called as column level constraints.

Table level constraint

Applying the constraints after defined all the column of the table or end the table if apply the constraints than these constraints called as table level constraints.

Example

	
CREATE TABLE table_name
(
column_name1 data_type(size) constraint_name,
column_name2 data_type(size) constraint_name,
column_name3 data_type(size) constraint_name,
....
);

What is a KEY?

A KEY is a value used to identify a record in a table uniquely. A KEY could be a single column or combination of multiple columns

Note: Columns in a table that are NOT used to identify a record uniquely are called non-key columns.

Constraints in SQL

  • Unique key
  • Not NUll
  • Primary key
  • Check
  • Foreign key
  • Default

SQL Update Command Primary Key in SQL

Google Advertisment

Buy This Ad Space @$20 per Month, Ad Size 600X200 Contact on: hitesh.xc@gmail.com or 9999595223

Magenet is best Adsense Alternative here we earn $2 for single link, Here we get links ads. Magenet

For Projects 9999595223

Google Advertisements


Buy Websites 9999595223

Buy College Projects with Documentation Contact on whatsapp 9999595223. Contact on: hitesh.xc@gmail.com or 9999595223 Try this Keyword C++ Programs

Advertisements