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

Examine about the behavioural diagrams, Examine about the Behavioural Diagr...

Examine about the Behavioural Diagrams  The main objective of behavioural diagrams is to visualize, specify, construct and document dynamic aspects of a system. The interactio

Describe the responsibilities of the dba and the database, Describe the res...

Describe the responsibilities of the DBA and the database designer ? The responsibilities of DBA and database designer are: 1. Planning for the database's future storage needs

Aggregation, Design a database for an airline.The database must keep track ...

Design a database for an airline.The database must keep track of customers and their reservations,flights and their status, seat assignment on individual flights and, the schedule

Define functional and multivalued dependencies, Define functional and multi...

Define functional and multivalued dependencies.       Ans:  A functional dependency is a assets of the semantics of the attributes in a relation. The semantics point out how at

The sap profile parameter, While sorting, if the main storage available is ...

While sorting, if the main storage available is not enough, the system writes data to an external help file.  The SAP profile parameter, which determines DIR_SORTTMP

Functional dependencies, 1. Staff (staffID --> availabilityID) 2. Servic...

1. Staff (staffID --> availabilityID) 2. Services (servicesID --> itemBasedID --> timedBasedID) 3. TimedBased (timedbasedID--> priceid) 4. Clients (clientId, serviceId-->

Define query processing, Define Query Processing Query processing is th...

Define Query Processing Query processing is the process of selecting the best plan or strategy to be employed in responding to a database request. The plan is then executed to

Design a gennalization and specialization hierarchy for an a, Design a genn...

Design a gennalization and specialization hierarchy for an automobile sales company

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