처음 접해 보는거라 모르겟네요... 이해도 안가고요... 테이블을 생성하라 이러는거 같은데...
죄송하지만....설명 점 부탁드립니다.
※ You want to make a database that consist of following four tables.
Table Name
|
Column Name
|
Data Type
|
NULL
|
Primary
Key
|
Foreign
Key
|
FK Table
|
FK Column
|
etc
|
customer
|
id
|
varchar(10)
|
not null
|
PK
|
|
|
|
|
name
|
varchar(30)
|
null
|
|
|
|
|
|
address
|
varchar(100)
|
null
|
|
|
|
|
|
Table Name
|
Column Name
|
Data Type
|
NULL
|
Primary
Key
|
Foreign
Key
|
FK Table
|
FK Column
|
etc
|
product
|
id
|
varchar(10)
|
not null
|
PK
|
|
|
|
|
name
|
varchar(30)
|
null
|
|
|
|
|
|
description
|
varchar(100)
|
null
|
|
|
|
|
|
price
|
integer
|
null
|
|
|
|
|
|
q
|
integer
|
null
|
|
|
|
|
|
Table Name
|
Column Name
|
Data Type
|
NULL
|
Primary
Key
|
Foreign
Key
|
FK Table
|
FK Column
|
etc
|
orders
|
id
|
varchar(20)
|
not null
|
PK
|
|
|
|
|
in_date
|
datetime
|
null
|
|
|
|
|
|
due
|
datetime
|
null
|
|
|
|
|
|
clerk
|
varchar(30)
|
null
|
|
|
|
|
|
terms
|
varchar(100)
|
null
|
|
|
|
|
|
customer_id
|
varchar(10)
|
null
|
|
FK
|
customer
|
id
|
|
Table Name
|
Column Name
|
Data Type
|
NULL
|
Primary
Key
|
Foreign
Key
|
FK Table
|
FK Column
|
etc
|
order_detail
|
state
|
varchar(10)
|
not null
|
|
|
|
|
|
order_id
|
varchar(20)
|
not null
|
PK
|
FK
|
orders
|
id
|
|
product_id
|
varchar(10)
|
not null
|
PK
|
FK
|
product
|
id
|
|
1. Write SQL sentences for creation of database with four tables.
(Here, the name of database is shop)
2. Add columns of 'h_phone' and 'o_phone' to CUSTOMER table.
3. Delete column of 'h_phone' in CUSTOMER table.
4. Set the CHECK constraint at column of 'state' in ORDER_DETAIL table. (conditions: 'admin_order', 'complete_order', 'ready_post', 'complete_post')
5. Set the NOT NULL constraint at column of 'name' in CUSTOMER table.
|