LoginSignup
5
6

More than 5 years have passed since last update.

オラクルCreate文

Last updated at Posted at 2014-05-12

忘れていたので復習を・・・。

■Create文

create table SAMPLE_TABLE
 (
    SAMPLE_ID char(3),
    SAMPLE_FID char(5),
    SAMPLE_NAME varchar2(10),
    constraint PK_SAMPLE_ID primary key( SAMPLE_ID ),
    constraint FK_SAMPLE_FID foreign key ( SAMPLE_FID ) references SAMPLE_FOREIGN_TABLE( SAMPLE_FID )
 )

CREATE TABLE <表名>
(
   <列名> <データ型>
 , <列名> <データ型> <列制約>
 , ・・・・
)

列制約には、以下のようなものがある
 ・primary key ← 一意制約とNOT NULL制約の複合
 ・foreign key ← 他のテーブルの主キーまたは一意キーを参照する制約
 ・not null  ← NULL値を禁止する

5
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
6