Re: How do I create tables in Oracle (SQL)? I need to ...

From: M. Armaghan Saqib <armaghan_at_yahoo.com>
Date: Sat, 11 Mar 2000 03:02:25 GMT
Message-ID: <8acd00$gvu$1_at_nnrp1.deja.com>



You question is little ambigous. If all you want is create table syntax then
you could try my tool SQLPlusPlus will helps you create any object with pre-built templates.

Here are some examples to create tables, indexes and constraints etc. You
can then modify this code according to your requirements and execute.

SQL> EXEC S2.BLDTAB
| ----------------------------------------------------------------------



-
| --> TABLE TIPS <--
| -- 1. SYSDATE, TO_DATE(SYSDATE), USER functions can be used for
DEFAULT
| -- 2. Always specify 0 (or other value) as default for NUMBER columns
to
avoid NULL values
| -- 3. For NUMBER cols you can also specify NUMBER(size, decimals) e.g.
NUMBER(12,3)
|
| DROP TABLE table1;
|
| CREATE TABLE table1(
| col1 VARCHAR2(50)-NUMBER-DATE DEFAULT def_val NOT NULL,
| col2 VARCHAR2(50)-NUMBER-DATE DEFAULT def_val NOT NULL,
| col3 VARCHAR2(50)-NUMBER-DATE DEFAULT def_val NOT NULL,
| col4 VARCHAR2(50)-NUMBER-DATE DEFAULT def_val NOT NULL,
| col5 VARCHAR2(50)-NUMBER-DATE DEFAULT def_val NOT NULL,
| col6 VARCHAR2(50)-NUMBER-DATE DEFAULT def_val NOT NULL
| );

SQL> EXEC S2.BLDIND
| ----------------------------------------------------------------------



-
| DROP INDEX index1;
|
| CREATE INDEX index1 ON table1(
| col1,
| col2,
| col3
| );
|
| CREATE UNIQUE INDEX index1 ON table1(
| col1,
| col2,
| col3
| );
|
| CREATE BITMAP INDEX index1 ON table1(
| yes_no_col
| );
|

SQL> EXEC S2.BLDCON
| ----------------------------------------------------------------------



-
| -- Create PRIMARY KEY ...
| ALTER TABLE table1 ADD CONSTRAINT
| pk_name PRIMARY KEY (col1, col2, col3);
|
| -- Create UNIQUE KEY ...
| ALTER TABLE table1 ADD CONSTRAINT
| uk_name UNIQUE (col1, col2, col3);
|
| -- Create FOREIGN KEY ...
| ALTER TABLE table1 ADD CONSTRAINT
| fk_name FOREIGN KEY (col1, col2, col3)
| REFERENCES (col1, col2, col3)
| ON DELETE CASCADE;
|
| -- Create CHECK CONSTRAINT ...
| ALTER TABLE table1 ADD CONSTRAINT
| chk_name CHECK col_name1 IN ('A','B','C');
|

regards,
M. Armaghan Saqib

+---------------------------------------------------------------

| 1. SQL PlusPlus => Add power to SQL Plus command line
| 2. SQL Link for XL => Integrate Oracle with XL
| 3. Oracle CBT with sample GL Accounting System
| Download free: http://www.geocities.com/armaghan/
+---------------------------------------------------------------

| SQLPlusPlus now on http://www.ioug.org/
| "PL/SQL package that extends SQL*Plus to another dimension.
| Contains a PL/SQL code generator and set of extremely useful
| utilites with extensive documentation." IOUG Web Site
+---------------------------------------------------------------

blessed2 <blessed2_at_gateway.net> wrote in message news:8aa3qa$1c2$1_at_news.laserlink.net...

[Quoted] > create some category tables.  Thank you.
>
>



Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sat Mar 11 2000 - 04:02:25 CET

Original text of this message