Data Constraints
Rules are enforced on data being entered, and prevents the user from entering invalid data into tables are called constraints.
Oracle permits data constraints to be attached to table columns via SQL syntax that will seek data for integrity. Once data constraints are part of a table column construction, the oracle engine checks the data being entered into a table against the data constraints.
Both the create table and alter table sql verbs can be used to write sql sentences that attach constraints to a table column.
Once a constraint is attached to a table column, any sql Insert or Update statements causes these constraints to be applied to the data prior to it being inserted into the tables for storage.
Types of integrity Constraints/Data constraints
Domain Integrity Constraints:- Maintain value according to the specifications like ‘Not Null’ condition, so the use has to enter a value for the column on which it is specified. ‘Not Null’ and ‘Check’ constraints fall under this category.
Entity Integrity Constraints:- Maintain a Uniqueness in a record.
Referential Integrity Constraints:- Enforces relation ships between tables
Oracle Allows programmers to define constraints at
- Column Level
- Table Level
Column level Constraints:- Data constraints are defined along with the column definition when creating or altering table structure, they are column level constraints.
Table Level Constraints:- If data constraints are defined after defining all the table columns when creating or altering a table structure, it is a table level constraint.
NULL :- If the column was created as nullable this is oracle default construction Oracle will place a NULL value in the column in absence of a user defined value.
- A NULL value is different from a blank or zero NULL values are treated are separately by oracle. A null value can be Inserted in to the columns of any datatype.
- Setting a NULL value is appropriate when the actual value is unknown or when a value would not be meaningful.
- A Null value is not equivalent to a value of zero if the data type is number and spaces if the data type is character.
- A NULL value will evaluate to NULL in any expression.
- NULL value can be inserted into columns of any data type.
- If the column has a NULL value, Oracle ignores the UNIQUE, FOREIGHN KEY, CHECK constraints that may be attached to the column.
For
More Explanation
&
Online Classes
More Explanation
&
Online Classes
Contact Us:
+919885348743
+919885348743