(데이터베이스) 다중 테이블 연산
같은 결과를 내는 여러가지 방법.
1.
CREATE TABLE profession
(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
profession varchar(20)
);
INSERT INTO profession(profession)
SELECT profession FROM my_contacts
GROUP BY profession
ORDER BY profession
2.
CREATE TABLE profession AS
SELECT profession FROM my_contacts
GROUP BY profession
ORDER BY profession
ALTER TABLE profession
ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY(id);
3. CREATE TABLE profession
(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
profession varchar(20)
)AS
SELECT profession FROM my_contacts
GROUP BY profession
ORDER BY profession
1.
CREATE TABLE profession
(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
profession varchar(20)
);
INSERT INTO profession(profession)
SELECT profession FROM my_contacts
GROUP BY profession
ORDER BY profession
2.
CREATE TABLE profession AS
SELECT profession FROM my_contacts
GROUP BY profession
ORDER BY profession
ALTER TABLE profession
ADD COLUMN id INT NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY(id);
3. CREATE TABLE profession
(
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
profession varchar(20)
)AS
SELECT profession FROM my_contacts
GROUP BY profession
ORDER BY profession
댓글
댓글 쓰기