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 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

What is Asterisk in SQL? Asterisk (*): In SQL, the columns for all the tables and views in the FROM clause will be displayed.

For problems 1-4, give all candidate keys for the tables with FDs specified.  Composite candidate keys must be put in parentheses, and candidate keys must be separated with commas

losers with new information systems

If R1 and R2 are two union compatible relations or functions, then the result of R3 = R1 ∩R2 is the relation that contains all tuples that are in both the relations In other words,

A practice called Perfect Pets provides private health care for domestic pets throughout America. This service is provided through various clinics located in the main cities of Ame

What is DML (Data Manipulation Language)? This language that enable user to access or manipulate data as organised by appropriate data model. Procedural DML or Low level: DM

What do you mean by persistence? How you will make your data persistent? Persistent data is the data, which has a longer lifetime than program which has created it. Enabling th

Eliminate Columns Not Dependent On Key The Employee Relation satisfies - First normal form - As it has no repeating groups. Second normal form - As it do not have multi-a

Suppose an instruction takes 1 nanosecond to execute (on average), a page fault takes 20 microseconds of processor time, and it takes 300 microseconds of disk time to read or write