BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Domain constraints in DBMS

Last Updated: November 19, 2018 by Chaitanya Singh | Filed Under: DBMS

A table is DBMS is a set of rows and columns that contain data. Columns in table have a unique name, often referred as attributes in DBMS. A domain is a unique set of values permitted for an attribute in a table. For example, a domain of month-of-year can accept January, February….December as possible values, a domain of integers can accept whole numbers that are negative, positive and zero.

Definition: Domain constraints are user defined data type and we can define them like this:
Domain Constraint = data type + Constraints (NOT NULL / UNIQUE / PRIMARY KEY / FOREIGN KEY / CHECK / DEFAULT)

Example:
For example I want to create a table “student_info” with “stu_id” field having value greater than 100, I can create a domain and table like this:

create domain id_value int
constraint id_test
check(value > 100);

create table student_info (
stu_id id_value PRIMARY KEY,
stu_name varchar(30),
stu_age int
);

Another example:
I want to create a table “bank_account” with “account_type” field having value either “checking” or “saving”:

create domain account_type char(12)
constraint acc_type_test
check(value in ("Checking", "Saving"));

create table bank_account (
account_nbr int PRIMARY KEY,
account_holder_name varchar(30),
account_type account_type
);
❮ PreviousNext ❯

Top Related Articles:

  1. Mapping constraints in DBMS
  2. Instance and schema in DBMS
  3. Deadlock in DBMS
  4. Foreign key in DBMS
  5. Primary key in DBMS

About the Author

I have 15 years of experience in the IT industry, working with renowned multinational corporations. Additionally, I have dedicated over a decade to teaching, allowing me to refine my skills in delivering information in a simple and easily understandable manner.

– Chaitanya

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

DBMS Tutorial

Basics

  • DBMS Tutorial
  • DBMS Introduction
  • Database Applications
  • DBMS vs File System
  • DBMS vs RDBMS
  • DBMS Architecture
  • Three-level DBMS architecture
  • View in DBMS
  • Abstraction
  • Instance & Schema
  • DBMS languages

Data Models

  • Data Models
  • ER Diagram
  • ER Design issues
  • Convert ER to table
  • DBMS Generalization
  • DBMS Specialization
  • DBMS Aggregration
  • Relational Model
  • Hierarchical Model
  • Constraints
  • Cardinality

Relational Database

  • RDBMS concepts
  • Relational Algebra
  • Relational Calculus
  • Keys Index
  • Primary Key
  • Super Key
  • Candidate Key
  • Foreign Key
  • Composite Key
  • Alternate Key

Normalization

  • Normalization
  • Functional dependency

Transaction Management

  • Transaction Management
  • ACID properties
  • Transaction States
  • DBMS Schedules
  • Serializability
  • Conflict Serializability
  • View Serializability
  • Recoverability Of Schedule
  • Failure Classification
  • Log based Recovery
  • DBMS Checkpoint
  • Deadlock

Concurrency Control

  • Concurrency Control
  • Lock based protocol
  • Timestamp based protocol
  • Validation based protocol

File Organization

  • File Organization
  • Sequential File Organization
  • Heap File Organization
  • Hash File Organization
  • DBMS ISAM
  • B+ File Organization
  • Cluster File Organization

SQL Introduction

  • SQL Introduction
  • SQL Characteristics
  • Advantages of SQL
  • SQL Commands
  • SQL Operators
  • SQL CREATE
  • SQL DROP
  • SQL SELECT
  • SQL INSERT

Copyright © 2012 – 2025 BeginnersBook . Privacy Policy . Sitemap