Column constraints, Database Management System

Assignment Help:

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.


Related Discussions:- Column constraints

Key constraint - relational constraints, This constraint shows that the key...

This constraint shows that the key attribute value in each tuple must be unique, i.e., no two tuples have the similar value for the key attribute. This is because the value of the

What is repository?, Problem 1 Why are the operational system keys not ...

Problem 1 Why are the operational system keys not recommended for forming data warehouse primary keys? Give any two examples 2 Explain the following performance tuning techn

Give an example of operations from the state actions, Give an example of op...

Give an example of operations from the State Actions and Activities. For instance, in bank the activity verify account code and verify password

Query evolution, what is query processing ,query optimization and performan...

what is query processing ,query optimization and performance turring?

Distributed and client server databases, Distributed And Client Server Data...

Distributed And Client Server Databases Introduction This unit tells the distributed database systems which are primarily relational and one important execution model: the

Why were functional methods fashionable in early days, Why were functional ...

Why were functional methods fashionable in early days? These are inspired directly by computer architecture and thus popular among computer scientist in early days. The divisio

How many types of data independence have, Types of data independence D...

Types of data independence Data independence can be classified into the following two types: Physical Data Independence: This means that for any change made in the physi

Determine Which is not a consequence of concurrent operation, Determine Whi...

Determine Which is not a consequence of concurrent operations? Ans: Update anomaly.

Project, the of super market system done in database

the of super market system done in database

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