Aug 4, 2010

Basics - Table in Oracle

Table - Basic unit of storage; composed of rows  and columns

Naming Rules - 

1. Table names and column names:
2. Must begin with a letter
3•3. Must be 1–30 characters long
4. Must contain only A–Z, a–z, 0–9, _, $, and #
5. Must not duplicate the name of another object owned by the same user
6. Must not be an Oracle server reserved word

CREATE TABLE statement -

1. You must have:
CREATE TABLE privilege
A storage area
2. You specify:
Table name
Column name, column data type, and column size

Refer other user's table - 

Tables belonging to other users are not in the user’s schema.
You should use the owner’s name as a prefix to those tables.
 

For example :

CREATE TABLE dept (deptno NUMBER(2),
dname VARCHAR2(14),
loc VARCHAR2(13));
Table created.

DESCRIBE dept

Name    Null?  type
DEPTNO         NUMBER(2)
DNAME          VARCHAR2(14)
LOC            VARCHAR2(13)

No comments:

Post a Comment