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

Er schema can be represented by relation schemas , Q. Describe how an ER sc...

Q. Describe how an ER schema can be represented by relation schemas and constraints arising from ER design can be mapped to constraints on a relation schema.     The entity rela

Distributed query and transaction processing, a.  Construct a query around ...

a.  Construct a query around any one of the functional divisions you made in 4a such that if executed in the distributed design of 4 would require reconstruction of at least two ho

Explain the steps for reduction of e-r model, Explain the steps for reducti...

Explain the steps for reduction of E-R model into relational model. Ans:(a) Entity set in E-R model will be considered as table name in relational Model. (b) Attributes of e

Design and implement a database system, Safe Banking is a Canberra based cr...

Safe Banking is a Canberra based credit union, which has several branches around Canberra and Queanbeyan. YOU have taken over Safe Banking. YOU need to create a database that organ

What is a view, What is a view?  Make a view of EMP table named DEPT 20, to...

What is a view?  Make a view of EMP table named DEPT 20, to display the employees in department 20 and their annual salary.  Ans:  View is a virtual table that does not consist

Define clause in sql to specify query result must be sorted, The clause in ...

The clause in SQL which specifies that the query result should be sorted in ascending or descending order based upon the values of one or much more columns is Ans : Order by

Define access time, Define access time. Access time is the time from wh...

Define access time. Access time is the time from when a read or write request is issued to when data transfer starts.

Product adder required for ecommerce website, Product adder required for Ec...

Product adder required for Ecommerce website Project Description: Want a product adder for 500 products I have a magento website and need products pulled from site A to my si

Define the five basic operators of relational algebra, Define the five basi...

Define the five basic operators of relational algebra? Five basic operators of relational algebra are: 1. Union (∪∪∪∪) - Selects tuples which are in either P or Q or in both

Draw the architecture of mysql, Data Base Management System 1. Draw the...

Data Base Management System 1. Draw the Architecture of MySQL and explain about its subsystems briefly. 2. Elaborate with the help of an example the concept of Primary key a

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