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

Database, i would like to ask if you will do assignment of database number ...

i would like to ask if you will do assignment of database number of words 1500 and how much

Define hot swapping, Define hot swapping? Hot swapping permits the remo...

Define hot swapping? Hot swapping permits the removal of faulty disks and changes it by new ones without turning power off. Hot swapping decreases the mean time to repair.

#title., losers with new information systems

losers with new information systems

Describe the nested-loop join and block-nested loop join, Describe the nest...

Describe the nested-loop join and block-nested loop join.   Ans:   The block nested- loop join algorithm is as described below:     for every block B r of relation R do beg

Define integrity, (a) Explain briefly the three parts of a relational Model...

(a) Explain briefly the three parts of a relational Model. (b) Contrast the following terms with an appropriate example: (i) stored attribute v/s derived attribute (ii) en

What is a dataset, What is a dataset? A dataset is an in-memory databas...

What is a dataset? A dataset is an in-memory database that is disconnected from any regular database, but has all the significant characteristics of a regular database. Dataset

Create the database in oracle using ddl, The Assessment page has a link to ...

The Assessment page has a link to download a conceptual model, and a list of data. You are to map this conceptual model, and create the database in Oracle using your own DDL.  T

Determine the subsystem design issue, Determine the Other System Design Iss...

Determine the Other System Design Issue How to realise subsystems; through hardware or software? How is object model mapped on chosen hardware software? Mapping

Database project, A database to track your progress in your college program...

A database to track your progress in your college program will track your progress towards graduation! A database that has information containing the classes that you have taken, c

What are wait-for-graphs, What are wait-for-graphs?Give the algorithm to co...

What are wait-for-graphs?Give the algorithm to construct a wait-for-graph from a given schedule of transactions? How can deadlocks be detected from wait-for-graphs?   Ans:  The

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