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

What are referential integrity constraints, What are referential integrity ...

What are referential integrity constraints? A value that appears in single relation for a given set of attributes also appears for a particular set of attributes in another rel

Can you delete data element, Can we delete data element, which is being use...

Can we delete data element, which is being used by table fields. No we cant delete data element.

Define average seek time, Define average seek time. The average seek ti...

Define average seek time. The average seek time is the average of the seek times, calculated over a sequence of random requests.

Central database schema, Consider an information system designed for an onl...

Consider an information system designed for an online company which provides IT products and services. These include desktops, laptops, networking products, IT books, parts, and te

What does conceptual design work, What does conceptual design work? A c...

What does conceptual design work? A conceptual design involves modelling independent of the DBMS.

ER Diagram, Soccer player ER Diagram to Relational database schema

Soccer player ER Diagram to Relational database schema

Describe relational model, Describe relational model? Structure of rela...

Describe relational model? Structure of relational data base Basic structure Database schema Keys Schema diagram Query languages

Cost of reading a file , A file of employee have 10,000 blocks on a cylinde...

A file of employee have 10,000 blocks on a cylinder of a disk with characteristics r=8ms and btt=0.6ms I want to know the cost of read inthe file under following conditions for a q

Schema, difference between internal schema and external schema in DBMS

difference between internal schema and external schema in DBMS

Differance between unordered and ordered file, Differance between Unordered...

Differance between Unordered and ordered file ? Unordered file do no has any sequence although ordered file has arranged in a few sequence and data are assigned in ordered form

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