SQL> create table foo (x number, y char(2))
     pctfree 12		/* 12% of space avail. for tuple updates (default 10)*/
     pctused 45		/* if <= 45% full, allow insertions (default 40)*/
     storage (initial 100000 pctincrease 2);
	/* allocate 100000 bytes for file; increase by 2% when more room
	   is needed (defaults 5 pages, 50% increase) */

Table created.

SQL> create cluster personnel (dnum number);
/* any table can become part of this cluster; all tuples will be clustered
based on their values in the column that references "dnum") */

Cluster created.

SQL> create table emp (name char(20), ssn number, sal number, dno number)
     cluster personnel (dno);
/* "dno" field values determine physical cluster placement */

Table created.

SQL> alter table emp add primary key (ssn);
/* always a good idea to have one of these... */

Table altered.

SQL> create table dept (dname char(32), dnum number primary key, floor number)
     cluster personnel (dnum);
/* dept tuples will be clustered based on their "dnum" values */

Table created.

SQL> insert into dept values ('Music', 1, 3);
insert into dept values ('Music', 1, 3)
            *
ERROR at line 1: 
ORA-02032: clustered tables cannot be used before the cluster index is built 


SQL> create index personnel_index on cluster personnel;
/* all clusters are maintained via an index (clustered) on the 
   clustering attributes of each relation */

Index created.

SQL> insert into dept values ('Music', 1, 3);

1 row created.

SQL> create cluster projects (proj_num number)
     size 2K		/* estimated size of a single cluster */
     hashkeys 500	/* use a hash index instead of B* tree, ~500 buckets */
     storage (initial 100K next 50K pctincrease 10);
	/* file starts with 100KB, another 50K when that is exceeded, then
	   in 10% increments beyond that */
	
Cluster created.

