create schema nodejs;
use nodejs;
create table nodejs.users(
id INT NOT NULL auto_increment,
name varchar(20) not null,
age int unsigned not null,
married tinyint not null,
comment text null,
created_at DATETIME not null default now(),
primary key(id),
unique index name_unique (name ASC))
comment = '사용자 정보'
default character set = utf8
engine = InnoDB;
create table comments(
id int not null auto_increment,
commenter int not null,
comment varchar(100) not null,
created_at datetime not null default now(),
primary key(id),
index comment_idx(commenter asc),
constraint commenter
foreign key (commenter)
references nodejs.users (id)
on delete cascade
on update cascade)
comment = '댓글'
default charset = utf8mb4
engine = InnoDB;
파워포인트는 그림 캡쳐라서 복사용 게시물 남깁니다