SQL

#057 DB 및 테이블 생성

Ahn_Bo 2020. 12. 14. 13:48
// DB생성
drop database if exists textBoard;
create database textBoard;
use textBoard;

// 게시물 테이블 생성
create table article (
	id int(10) unsigned not null auto_increment,
	regDate datetime not null,
	updateDate datetime not null,
	title char(200) not null,
	`body` text not null,
	memberId int(10) unsigned not null,
	boardId int(10) unsigned not null
);

// 게시물 데이터 3개 생성
insert into article
set regDate = now(),
updatedDate = now(),
title = '제목1',
`body` = '내용1',
memberId = 1,
boardId = 1;

insert into article
set regDate = now(),
updatedDate = now(),
title = '제목2',
`body` = '내용2',
memberId = 2,
boardId = 2;

insert into article
set regDate = now(),
updatedDate = now(),
title = '제목3',
`body` = '내용3',
memberId = 3,
boardId = 3;

 

 

*전체적인 일상은 노션을 통해 작성하고 있습니다.

링크 : www.notion.so/025-3224dff388e649038676b4c6e3a4f07e