

CREATE TABLE topic (
id INT(11) NOT NULL AUTO_INCREMENT,
title VARCHAR(100) NOT NULL,
description TEXT NULL,
created DATETIME NOT NULL,
author VARCHAR(15) NULL,
profile VARCHAR(200) NULL,
PRIMARY KEY(id));

SHOW TABLES;
DESC topics;
INSERT INTO topic (title, description, created, author, profile)
VALUES('MySQL', 'MySQL is...', NOW(), 'egoing', 'developer');
INSERT INTO topic (title, description, created, author, profile)
VALUES('ORACLE', 'ORACLE is', NOW(), 'egoing', 'developer');
INSERT INTO topic (title, description, created, author, profile)
VALUES('SQL Server', 'SQL Server is...', NOW(), 'duru', 'datebase administrator');
INSERT INTO topic (title, description, created, author, profile)
VALUES('PostgreSQL', 'PostgreSQL is...', NOW(), 'taeho', 'datebase scientist, developer');
INSERT INTO topic (title, description, created, author, profile)
VALUES('MongoDB', 'MongoDB is...', NOW(), 'egoing', 'developer');
SELECT * FROM topic;
SELECT id, title, created, author FROM topic;
SELECT id, title, created, author FROM topic WHERE author = 'egoing';
‘id’를 기준으로 DESC (내림차순)
SELECT id, title, created, author FROM topic WHERE author = 'egoing' ORDER BY id DESC;
SELECT id, title, created, author FROM topic WHERE author = 'egoing' ORDER BY id DESC LIMIT 2;
❗ WHERE 조심하기
UPDATE topic SET description = 'Oracle is...', title = 'Oracle' WHERE id = 2;
❗ WHERE 조심하기
DELETE FROM topic WHERE id = 5;