카테고리 없음
9주차 과제 데이터베이스 생성
jjon-jonny
2024. 5. 23. 13:36
CREATE TABLE account (
idx INT AUTO_INCREMENT PRIMARY KEY,
id varchar(40) UNIQUE NOT NULL,
pw varchar(40) NOT NULL,
name varchar(20) NOT NULL,
tell varchar(15) NOT NULL,
position VARCHAR(6) NOT NULL CHECK (position IN ('leader', 'member'))
department VARCHAR(7) NOT NULL CHECK (position IN ('develop', 'plan'))
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE schedule(
idx INT AUTO_INCREMENT PRIMARY KEY,
account_id varchar(40) NOT NULL,
datetime DATETIME NOT NULL,
content TEXT NOT NULL,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (account_id) REFERENCES account(id)
);
1 31
2 28
3 31
4 30
5 31
6 30
7 31
8 31
9 30
10 31
11 30
12 31