Column constraints, Database Management System

Column Constraints: NOT NULL, UNIQUE, CHECK, PRIMARY KEY, DEFAULT, REFERENCES,

On  delete  Cascade:  Using  this  key  whenever  a  parent  row  is  removed  in  a referenced table then all the corresponding child rows are removed from the referencing table. This constraint is a form of referential integrity constraint.

Example 1:

CREATE TABLE product

(

pno number (4) PRIMARY KEY, pname char (20) NOT NULL,

qoh number (5) DEFAULT (100),

 class char (1) NOT NULL,

rate number (8,2) NOT NULL,

CHECK ((class='A' AND rate<1000) OR (class='B' AND rate>1000 AND rate<4500) OR (class='C' AND rate>4500))

);

The command above makes a table. Primary key constraint makes sure that product number (pno) is not null and unique (both are the properties of primary key). Please note down the use of data type char (20). In many executions of SQL on commercial DBMS such as Oracle and SQL server, a data type known as varchar and varchar2 is used respectively. Varchar mainly is variable length character type subject to a maximum specified in the declarations. We will use them at most of the places soon.

Please note the use of check constraints in the table formed above. It correlates two dissimilar attribute values.

Posted Date: 3/11/2013 12:55:29 AM | Location : United States







Related Discussions:- Column constraints, Assignment Help, Ask Question on Column constraints, Get Answer, Expert's Help, Column constraints Discussions

Write discussion on Column constraints
Your posts are moderated
Related Questions
Define Forms Based Interfaces? Forms-Based Interfaces - A forms-based interface display a form to each user. Forms are commonly designed and programmed for naive users and inte

The Transactions- A transaction is definite as the unit of work in a database system. Database systems that deal with a huge number of transactions are also termed as transaction p

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

Column Constraints: NOT NULL, UNIQUE, CHECK, PRIMARY KEY, DEFAULT, REFERENCES, On  delete  Cascade :  Using  this  key  whenever  a  parent  row  is  removed  in  a referenced

Explain the Object-oriented decomposition Object-oriented decomposition targets at identifying individual sovereign objects that encapsulate both a state and certain behavio

Operator Precedence The basic operators used in SQL are * /   - + Operators of the similar priority are evaluated From Left to right Parentheses are used to force priorit

For the question given below, you are required to submit design and implementation documentation as described over the page. Design, implement (in Java), test and document a set of

Determine the rule that a value of a foreign key should appear as a value of some particular table is called a  Ans: Referential constraint.    The rule that a value of a fo

prototype of a distributed information system for a national car part retail outlet chain.

Differentiate between a subquery and a join If we need to acquire information from one or more tables after that either subquery or join can be used. If the columns which are t