1)CREATE TABLE 코드 예제
2)INSERT INTO 코드 예제
3)DROP TABLE 코드 예제
CREATE TABLE author(
aid int not null,
name varchar(20) default null primary key,
city varchar(10) default null,
profile_id int default null,
)
INSERT INTO author values(1,'egoinh','seoul',1),(2,'leezche','jeju',2),(3,'blackdew','namhae',3);
CREATE TABLE profile(
pid int not null primary key,
title varchar(10) default null,
description varchar(100)
)
insert into profile values(1,'developer','developer is...'),(2,'designer','designer is...'),(3,'dba','dab is...');
create table topic(
tid int not null primary key,
title varchar(45) default null,
description varchar(100),
author_id varchar(45) default null
)
insert into topic values(1,'HTML','HTML IS...',1),(2,'CSS','CSS IS...',2),(3,'JAVASCRIPT','JAVASCRIPT IS...',3),(4,'DATABASE','DATABASE IS...',NULL);
drop table author
select * from author
select * from profile
select * from topic
CREATE TABLE author(
aid int not null,
name varchar(20) default null primary key,
city varchar(10) default null,
profile_id int default null,
)
INSERT INTO author values(1,'egoinh','seoul',1),(2,'leezche','jeju',2),(3,'blackdew','namhae',3);
CREATE TABLE profile(
pid int not null primary key,
title varchar(10) default null,
description varchar(100)
)
insert into profile values(1,'developer','developer is...'),(2,'designer','designer is...'),(3,'dba','dab is...');
create table topic(
tid int not null primary key,
title varchar(45) default null,
description varchar(100),
author_id varchar(45) default null
)
insert into topic values(1,'HTML','HTML IS...',1),(2,'CSS','CSS IS...',2),(3,'JAVASCRIPT','JAVASCRIPT IS...',3),(4,'DATABASE','DATABASE IS...',NULL);
drop table author
select * from author
select * from profile
select * from topic
'개발 > SQL' 카테고리의 다른 글
[SQL] USING 사용 방법 (0) | 2023.01.28 |
---|---|
[SQL] 테이블의 연산, MINUS, EXCEPT, INTERSECT, UNION (0) | 2023.01.28 |
[SQL] LEFT OUTER JOIN, RIGHT OUTER JOIN, INNER JOIN 설명 (0) | 2023.01.28 |
[SQL] MSSQL 실행순서 (0) | 2023.01.20 |
[MSSQL] JOIN정리 LEFT JOIN, INNER JOIN, RIGHT JOIN 정리 (0) | 2022.08.24 |