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 is business intelligence, Question A What is operational intelligence...

Question A What is operational intelligence? Question B What is Business Intelligence? Explain the components of BI architecture Question C Differentiate between databas

What is a linked server, What is a Linked Server? Linked Servers is a m...

What is a Linked Server? Linked Servers is a method in SQL Server by which we can add other SQL Server to a Group and query both the SQL Server dbs using T-SQL Statements. With

Secondary indexes, Secondary Indexes Let consider the student database ...

Secondary Indexes Let consider the student database and its clustering index and primary (only one will be applicable at a time). Now consider the state when the database is to

What is dag, What is DAG? The class-subclass relationship is shown by a...

What is DAG? The class-subclass relationship is shown by a directed acyclic graph.eg: employees can be temporary or permanent. We might be create subclasses temporary \and perm

Enforce referential integrity, Use Access 2007 to create a database calle...

Use Access 2007 to create a database called UniLib.mdb. - this file should be created on your personal drive at the university (or C: if you're using Access 2007 at home) and t

Create an er diagram completely with attributes, A database is to be constr...

A database is to be constructed to remain track of the teams and games of a sport league. A team has a number of players, not all of whom participate in every game. It is desired

Give the relational calculus queries of players in sql, An orchestra databa...

An orchestra database consists of the following relations: CONDUCTS (conductor, composition) REQUIRES (composition, Instrument) PLAYS (Player, Instrument) Give the relational

Dbms, You are managing the following database system: • DBMS: Oracle 11g ...

You are managing the following database system: • DBMS: Oracle 11g • OS: Sun Solaris • System architecture: Web-based application using ASP.Net • Purpose of Server: HR managem

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