Constraints are used to limit the type of data that can go
into a table.
two basic types of constraints are there
the difference is that column level constraints are apply
only to one column where as table level constraints are
apply to whole table
Constraints are declare at the time of table creation using
CREATE TABLE command
there are 6 constraints used in oracle
There are a number of different ways to implement
constraints, but each of them falls into one of these three
Referential integrity constraints.
Domain Constraints: A Domain constraint deals with one or
more columns. It is important to ensure that a particular
column or a set of columns meets particular criteria. When
you insert or update a row, the constraint is applied
without respect to any other row in the table. The focus is
on the data that is in the column. These kinds of
constraints will resurface when we deal with Check
constraints, Default constraints and rules and defaults.
Entity Constraints: Entity constraints are all about
individual rows. This constraint ignores the column as a
whole and focuses on a particular row. This can be best
exemplified by a constraint that requires every row to have
a unique value for a column or a combination of columns.
This is to ensure that for a particular row, the same value
does not already exist in some other row. We’ll see this
kind of constraint in dealing with Primary key and Unique
Referential Integrity Constraints: Referential integrity
constraints are created when a value in one column must
match the value in another column. It can either be in the
same table or more typically, a different table. For
example, we are taking orders for a product, and we accept
credit payment. But we will accept only a few standard
credit card companies like Visa, MasterCard, Discover, and
American Express. Referential integrity constraints allow
us to build what we would call a domain table. A domain
table is table whose sole purpose is to provide a limited
list of acceptable values. In our case we have a CreditCard
table with CreditCardID, and CreditCard as fields. We can
then build one or more tables that reference the
CreditCardID column of our domain table. With referential
integrity, any table that is defined as referencing our
CreditCard table will have to have a column that matches up
to the CreditCardID column of our CreditCard table. For
each row we insert into the referencing table, it will have
a value that is in our domain list. We will see more of
this when we learn about Foreign key constraints.
If i have one transaction say mainTransaction, within this
mainTransaction i have another two transaction say t1 and t2.
Now while execution t1 completes successfully and commit
statement fires, but while executing t2 some error occurs
and rollback statement fires.
What happen to t1, is it rollback or not?
SQL stops working in every 15 days displaying message that
database log file is full. Log file size is 3.95 GB. It is
happening after shrinking the database also. What is
solution to overcome this problem. Please help me as it's
i have 4 tables.. T1, T2, T3, T4..
these tables have the same structure and they store the
information entered in different years..
T1 stored 2002, T2 stored 2003, T3 stored 2004 and T4 stored
i want to copy contents in T1 to T2, T2 to T3, T3 to T4 and
T4 to T1..
how do i do that? Temp tables cannot be used..