rename table 현재 이름 to 바꿀 이름
mysql> create table todo(
-> id int(11) not null auto_increment,
-> title varchar(100) not null,
-> curdate text,
-> writer_id int(11) default null,
-> primary key(id));
mysql> create table writer(
-> id int(11) not null auto_increment,
-> name varchar(30) not null,
-> profile varchar(30) default null,
-> primary key(id));
mysql> insert into writer (id, name, profile) values(1, 'lee', '개발자');
mysql> insert into writer (id, name, profile) values(2, 'kim', '기획자');
mysql> insert into writer (id, name, profile) values(3, 'park', '디자이너');
mysql> insert into todo (title, curdate, writer_id) values('지하철타기', '2022.11.15', 1);
mysql> insert into todo (title, curdate, writer_id) values('걷기', '2022.11.16', 2);
mysql> insert into todo (title, curdate, writer_id) values('커피마시기', '2022.11.17', 3);
mysql> insert into todo (title, curdate, writer_id) values('이닦기', '2022.11.18', 1);
mysql> insert into todo (title, curdate, writer_id) values('공부하기', '2022.11.19', 1);
select * from todo left join writer on todo.writer_id = writer.id;
select todo.id, title, curdate from todo left join writer on todo.writer_id = writer.id;
select todo.id as todo_id, title, curdate from todo left join writer on todo.writer_id = writer.id;
todo 테이블의 id 필드를 todo_id로 이름을 변경해서 출력
인터넷 위에서 데이터베이스가 동작하면 굉장히 파워풀한 효과를 낼 수 있다.
MySQL은 기본적으로 인터넷을 활용할 수 있는 구조이다.
인터넷이 사용되기 위해서 인터넷이 동작되기 위해서는 컴퓨터가 최소 몇 대 필요할까?
인터넷은 여러 컴퓨터가 연결되어 형성된 컴퓨터 사회라고 할 수 있다.
데이터베이스를 설치하면?
우리가 다루는 데이터베이스는 서버인가 클라이언트인가?
사용자는 무조건 클라이언트를 통해 서버에 접근할 수 있다.
우리가 사용했던 mysql 클라이언트 mysql.exe
Mysql 설치 시 mysql.exe가 제공되며 명령어를 통해 데이터베이스 서버를 제어할 수 있게 한다.
npm install --save node-mysql
(실습 오류)