Explain the two constraints check and foreign key in sql, Database Management System

Assignment Help:

Explain the two constraints, check and foreign key in SQL along with an example for each. Give the syntax.

CHECK constraint - CHECK constraint specifies an expression which must always be true for every row in the table. It can't refer to values within other rows.
Syntax:
ALTER TABLE
ADD CONSTRAINT CHECK();

FOREIGN KEY constraint - A foreign key is a combination of columns along with values based on the primary key values from another table. A foreign key constraint, also called as referential integrity constraint, specifies in which the values of the foreign key correspond to actual values of the primary or unique key in other table. One can refer to a primary or unique key in the similar table also.

Syntax:
ALTER TABLE
ADD CONSTRAINT FOREIGN KEY()
REFERENCES () ON {DELETE | UPDATE}
CASCADE;


Related Discussions:- Explain the two constraints check and foreign key in sql

Heap files (unordered file), Heap files (unordered file) Mostly these f...

Heap files (unordered file) Mostly these files are unordered files. It is the easiest and most basic type. These files having of randomly ordered records. The records will have

Describe different steps of object-oriented design process, Describe differ...

Describe different steps of the object-oriented design process.  The broad steps of the object-oriented design process are: a. Define context and modes of use of the system

Atomicity-transaction , Atomicity: It describes a transaction to be a one ...

Atomicity: It describes a transaction to be a one unit of processing. We can also say either a transaction will be finished completely or not at all. In the transaction example 1

Describe the definition of a transaction in sql, Describe the definition of...

Describe the definition of a transaction in SQL  Ans: The SQL transaction starts implicitly. Transactions are finished by either Commit work that commits the transaction and st

When it is better to use files than a dbms, When It is better to use files ...

When It is better to use files than a DBMS? It is better to use files than a DBMS when Multiple users wish to access the data.

What are advantages of object models, What are advantages of object models?...

What are advantages of object models? Object models are efficient for communicating with the application experts and reaching a consensus about the significant aspects of the p

Explain about database system structure, Explain about database system stru...

Explain about database system structure? Storage manager Authorization and integrity manager Transaction manager File manager Buffer manager Storage manager

What is meant by heuristic optimisation, What is meant by heuristic optimis...

What is meant by heuristic optimisation?Discuss the major heuristics that are applied during query optimisation.

Database Management System, please give me introduction to full data in D B...

please give me introduction to full data in D B M S in a short assignment

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd