Archive for the ‘Oracle’ Category

Oracle Constraints

Wednesday, February 14th, 2007

Constraints are used to keep accurate data. In oracle you can apply these policies to a column or table. There are five different types of constraints:

Constraint Abbreviation Description
PRIMARY KEY _pk This is a unique field that is not allowed to have null values.
FOREIGN KEY _fk This constraint is placed in the “many” table. The data that’s entered in this field must have a value in the parent table.
UNIQUE _uk All data that is stored in a column with a UNIQUE constraint on it will not have two of the same values. This constraint is a bit different from a PRIMARY KEY where the PRIMARY KEY does not allow NULLs, a UNIQUE constraint does allow NULLs.
CHECK _ck This constraint ensures that a specified condition is true before any data is added to the table.
NOT NULL _nn This makes sure that there is a value going into the table.

(more…)

Creating and Managing Tables in Oracle 10g

Wednesday, February 14th, 2007

When creating tables in Oracle we have to follow some rules in order to successfully create a table:

  • Table names and columns can be up to 30 characters long.
  • Names of tables and columns cannot have any blank spaces.
  • Numbers, underscores, and number signs are allowed in the table and column name.
  • Each table that a user owns must have a unique name and each column in that table must have a unique column name.
  • You can’t use reserved keywords as a table or column name.

(more…)