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

Benefits of views-data control, Benefits: It limits data access. ...

Benefits: It limits data access. It makes difficult queries look easy. It permits data independence. It presents dissimilar views of the similar data.

What is meant by object identifiers, What is meant by object identifiers? ...

What is meant by object identifiers? Object-oriented systems use an object identifier to recognize objects. Object identifiers are unique: that is every object has a single ide

System level permissions-data control, System level permissions : With the ...

System level permissions : With the use of data dictionary you can view them.       Let us take the table name as user_sys_privs (used in oracle).       DESCRIBE USER_SYS_PRI

List and also explain the dissimilar stages of ddlc, List and also explain ...

List and also explain the dissimilar stages of DDLC ?

State the steps of object design, State the Steps of Object Design ...

State the Steps of Object Design Object design is a very iterative process in which various classes, relationships among objects are added when you move from one level to

Explain the exec statement in sql, Explain the Exec statement in SQL An...

Explain the Exec statement in SQL Ans: Exec statement has the structure    EXEC SQL END-EXEC   Embeded SQl statements are of a form identical to non embedded SQL statem

Explain heap file with advantages, Explain heap file with advantages? H...

Explain heap file with advantages? Heap File is an unordered set or a group of records, stored on a set of pages. This class gives basic support for inserting, updating, select

Whenever the limit clause will be used, Whenever the LIMIT clause will be u...

Whenever the LIMIT clause will be used? LIMIT is used for the following kinds of problems: 1) Answering questions about first or last and largest or smallest 2) Splitting

What is mysql, What is MySQL? MySQL is a relational database management...

What is MySQL? MySQL is a relational database management system which has eleven million installations. It can be used for both Linux and Window. Managing database includes add

MULTI-LIST FILE ORGANIZATION, sir, could anybody help me in getting complet...

sir, could anybody help me in getting complete information about the mentioned topic

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