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

Submit SQL SELECT Statements to demonstrate several reports off your database, according to the following guidelines: You must submit at least 5 SELECT Statements. Each

Describe the objective of Structural Diagrams The main objective of structural diagram is to visualize, construct, specify and document static aspects of a system. Their eleme

Dependency Preservation It is obvious that the decomposition must be lossless so that we do not lose any information from the relation that is decomposed. Dependency preservati

Question (a) Differentiate between the following terms: (i) Distributed Database v/s Distributed Database management System (ii) Homogeneous Distributed Database v/s Hete

Design a gennalization and specialization hierarchy for an automobile sales company

Drawbacks of Data Distribution: The primary drawbacks of distributed database systems are the added complexity needed to ensure proper coordination between the sites. This increas

BCNF Boyce-Codd Normal Form A relation schema R is in BCNF if it is in 3NF and accepts an additional constraint that for every FD X A, X has to be a candidate key. If a relati

Design Of Distributed Databases: The distributed databases are mainly relational at local level. So a local database schema is the similar as that of a centralised database design

Project Description: Hi I'm seeking someone to make my dBase application work. I know it's not a 'modern' language but it's what I know. I have written an order program and I ne