SQL | CREATE DOMAIN Last Updated : 07 Sep, 2018 Comments Improve Suggest changes 17 Likes Like Report Used in : Postgre sql CREATE DOMAIN creates a new domain. A domain is essentially a data type with optional constraints (restrictions on the allowed set of values). The user who defines a domain becomes its owner. Domains are useful for abstracting common constraints on fields into a single location for maintenance. For example, several tables might contain email address columns, all requiring the same CHECK constraint to verify the address syntax. Define a domain rather than setting up each table's constraint individually. Examples: CREATE DOMAIN CPI_DATA AS REAL CHECK (value >= 0 AND value <= 10); Now CPI_DATA domain is create so, we can use this domain anywhere in any table of database as below : CREATE TABLE student( sid char(9) PRIMARY KEY, name varchar(30), cpi CPI_DATA ); Every time cpi_data will check the constraint, when you add data in student table. Example 1 : Insert into student values (201501408,Raj,7.5); This will not violate the property of cpi. Example 2 : Insert into student values (201501188,Dhaval,12); ERROR. This will violate the property of cpi. Create Quiz Comment D Dhaval Prajapati 17 Improve D Dhaval Prajapati 17 Improve Article Tags : Misc SQL SQL-Clauses-Operators Explore BasicsWhat is SQL?6 min readSQL Data Types3 min readSQL Operators5 min readSQL Commands | DDL, DQL, DML, DCL and TCL Commands4 min readSQL Database Operations3 min readSQL CREATE TABLE3 min readQueries & OperationsSQL SELECT Query3 min readSQL INSERT INTO Statement4 min readSQL UPDATE Statement3 min readSQL DELETE Statement3 min readSQL - WHERE Clause2 min readAliases in SQL2 min readSQL Joins & FunctionsSQL Joins (Inner, Left, Right and Full Join)4 min readSQL CROSS JOIN1 min readSQL | Date Functions3 min readSQL | String functions6 min readData Constraints & Aggregate FunctionsSQL NOT NULL Constraint2 min readSQL PRIMARY KEY Constraint5 min readSQL Count() Function4 min readSQL SUM() Function2 min readSQL MAX() Function3 min readAVG() Function in SQL2 min readAdvanced SQL TopicsSQL Subquery5 min readWindow Functions in SQL6 min readSQL Stored Procedures7 min readSQL Triggers5 min readSQL Performance Tuning6 min readSQL TRANSACTIONS6 min readDatabase Design & SecurityIntroduction of ER Model9 min readIntroduction to Database Normalization6 min readSQL Injection11 min readSQL Data Encryption5 min readSQL Backup4 min readWhat is Object-Relational Mapping (ORM) in DBMS?7 min read Like