Database Reference
In-Depth Information
Example:
ALTER TABLE customers
RENAME COLUMN limit TO amount;
One thing I would like to mention over here, if you want to get
rid of unwanted data is to utilize the beauty of CREATE TABLE
…. AS SELECT statement and then drop the original table.
Constraints also known as Data Integrity Constraints
While creating tables, besides mentioning about data types of
columns we can also assign constraints on each column
wherever we feel necessary. Constraints help in achieving data
integrity. In other words, before inserting or updating any
information in database Oracle instance makes sure that none of
the constraints get violated. For example if you have
implemented UNIQUE constraint on one column and if you try
to insert a record with a duplicate value that was already there in
the column having UNIQUE constraint, you will get a
“constraint violation” error. Let's study all of these constraints
and their applications one by one.
NOT NULL is a type of constraint once implemented on any
column; you would not be able to insert NULL values in it.
Similarly with UNIQUE, once defined on any column we would
not be able to insert any record in the table with a value that was
already there in UNIQUE constraint column.
Example:
CREATE TABLE dept
(deptno NUMBER(2),
dname VARCHAR2(9) CONSTRAINT unq_dname
UNIQUE,
loc VARCHAR2(10) );
Search WWH ::




Custom Search