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

What is meant by data-transfer rate, What is meant by data-transfer rate? ...

What is meant by data-transfer rate? The data-transfer rate is the rate at which data can be retrieved from or kept to the disk.

Database Models, Benefits and Limitations od Data Models?

Benefits and Limitations od Data Models?

Explain concurrency problems, Question: a) There are three concurrency...

Question: a) There are three concurrency problems, i.e. three types of potential mistake which could occur if concurrency control is not properly enforced in the database syst

Designing the database schema , The domain that you will model in this assi...

The domain that you will model in this assignment is that of courses and students at a university. So as not to make the task too large and unspecified, you will here get a descrip

Locking, define locking in simple language and decribed it

define locking in simple language and decribed it

Skills required, wrie a report on whether a BSc n information systems devel...

wrie a report on whether a BSc n information systems develops the skills required by employers in Database administration

By the relations get details of employees working in sql, Consider the rela...

Consider the relations: PROJECT(proj#,proj_name,chief_architect) EMPLOYEE(emp#,emp_name) ASSIGNED(proj#,emp#) Use relational algebra to express the subsequent queries: (i) Get

Write the queries in relational algebra, Problem: You are given the fol...

Problem: You are given the following schema 1. Flights(flno, from, to, distance) 2. Aircraft(aid, flno, aname, cruisingRange) 3. Certified(eid, aid) 4. Employees(eid, ena

What are costs to be considere when transaction is roll back, What are the ...

What are the costs to be considered when a transaction has to be rolled back when recovering from deadlock?         Ans: A few transaction will must rolled back (made a victim)

Define signal, Define Signal. It allows methods to respond to events tr...

Define Signal. It allows methods to respond to events triggered by themselves or by other processes. Each signal corresponds to an exacting event. A signal is represented in Sy

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