DDL Data Definition language

CREATE, ALTER, DROP

CREATE statement
syntax => CREATE objectType objectName attributes;


  CREATE TABLE "SCOTT"."PRODUCTS" 
  (
"PRODUCT_ID" NUMBER(10,0) NOT NULL ENABLE, 
"SUPPLIER_ID" NUMBER(10,0) NOT NULL ENABLE, 
"PRODUCT_NAME" VARCHAR2(20), 
"REGION_ID" NUMBER(10,0), 
UNIQUE ("PRODUCT_ID"),
CONSTRAINT "FK_SUPPLIER" FOREIGN KEY ("SUPPLIER_ID")
REFERENCES "SCOTT"."SUPPLIER" ("SUPPLIER_ID") ENABLE, 
CONSTRAINT "FK_REGION" FOREIGN KEY ("REGION_ID")
REFERENCES "SCOTT"."REGIONS" ("REGION_ID") ENABLE
    )

CREATE TABLE "SCOTT"."REGIONS" 
(
"REGION_ID" NUMBER(10,0), 
"REGION_NAME" VARCHAR2(20), 
CONSTRAINT "PK_REGION" PRIMARY KEY ("REGION_ID")
 )


CREATE TABLE "SCOTT"."SUPPLIER" 
(
"SUPPLIER_ID" NUMBER(10,0) NOT NULL ENABLE, 
"SUPPLIER_NAME" VARCHAR2(50) NOT NULL ENABLE, 
"CONTACT_NAME" VARCHAR2(50), 
 CONSTRAINT "SUPPLIER_PK" PRIMARY KEY ("SUPPLIER_ID")
 )
Comments