This video demonstrates step by step implementation of default expression and check constraints in details.
Lecture Summary
DEFAULT is used to insert the default value.
If default is set into column then we can insert it in 2 ways.
1. Using Default keyword
2. By skipping the column at time of insert.
Check constraint
It is used to put validation on column for each row.
Syntax:
CHECK (condition)
Example
1. CHECK(CITY = 'RAJKOT')
2. CHECK(LENGTH(MOBILE)=10)
3. CHECK(EMAILID LIKE '___%@__%.__%')
4. CHECK(SUBSTR(NAME,1,1) BETWEEN 'A' AND 'P')
5 CHECK (CITY IN ('AHM', 'RJT', 'SURAT'))
Note
CONSTRAINT constraint_name is recommended for each constraints to identify constraints at the time of violations.
Constraint name is unique within the database.
Syntax of table
CREATE TABLE table_name(
col1 data_type [default expr] [ [constraint constraint_name] constraint_type ],
col2 data_type [default expr] [ [constraint constraint_name] constraint_type ],
.
.
colN data_type [default expr] [ [constraint constraint_name] constraint_type ], [table_level_constraint]
)
For Learning More about Programming
Subscribe to My Channel: https://www.youtube.com/c/drparagshuk...
In questa pagina del sito puoi guardare il video online SQL - Lecture 3 - Default Expression & Check Constraints - Oracle - Practical Demonstrations della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Dr. Parag Shukla 08 dicembre 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 1,496 volte e gli è piaciuto 28 spettatori. Buona visione!