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

Parallelism of transaction execution-data fragmentation, Parallelism of tra...

Parallelism of transaction execution: A transaction can be divided into various sub-queries that can operate on fragments in parallel. This enhances the degree of concurrency in t

Draw the architecture of mysql, Data Base Management System 1. Draw the...

Data Base Management System 1. Draw the Architecture of MySQL and explain about its subsystems briefly. 2. Elaborate with the help of an example the concept of Primary key a

Construct an er diagram for a hospital, Construct an ER diagram for a hospi...

Construct an ER diagram for a hospital along with a set of patients and a set of medical doctors Associate with every patient a log of the several tests and examinations conducted.

Draw entity relationship diagram, Draw entity relationship diagram for the ...

Draw entity relationship diagram for the following scenario. A university has many departments whereas each department belongs to that particular uni. That uni has also many bui

Express the ways provided by mysql for pattern matching, Express the ways p...

Express the ways provided by MySQL for Pattern Matching? MySQL provides two kinds of pattern matching. 1) One is based on SQL patterns 2) Regular expressions.

Which file organization provides very fast access, Which file organization ...

Which file organization provides very fast access to any arbitrary record of a file? Hashed file organization provides very fast access to any arbitrary record of a file.

State about the tables- DBMS, State about the Tables- DBMS Data is sto...

State about the Tables- DBMS Data is stored in columns and rows (much like a spreadsheet -main difference is how data is organised). Every row in a table is known as a record

Project, I need help in doing my dbms project

I need help in doing my dbms project

Database, A database has been designed for this beauty parlour in order for...

A database has been designed for this beauty parlour in order for the staff to manage specific things such as bookings made by clients, payments, staff availability, level of exper

What is multiplicity in the associations, What is multiplicity in the assoc...

What is multiplicity in the associations? Give an example to explain multiplicity? Multiplicity in association indicate number of objects participate in any relationship. For

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