사이트 내 전체검색
PHP
[mysql] 테이블속성 및 구조변경법 - ALTER TABLE
로빈아빠
https://cmd.kr/php/385 URL이 복사되었습니다.

본문

ALTER TABLE 테이블명 CHANGE[COLUMN] 필드명 필드타입


-> 기존 테이블에 필드 추가하기


 


mysql> alter table testtable add column homepage varchar(30);


mysql> desc testtable;


 


-> 기존에 필드 속성 변경하기


ALTER TABLE 테이블명 CHANGE[COLUMN] 기존필드명 새필드명 필드타입


mysql> alter table testtable change column homepage home varchar(50);


 


-> 기존에 필드 삭제


ALTER TABLE 테이블명 DROP [COLUMN] 필드명


mysql> alter table testtable drop column home;


mysql> desc testtable;


 


-> 기존의 테이블삭제하기


mysql> create table sampletable


mysql> show tables;


mysql> drop table sampletable;


mysql> show tables;


 

댓글목록

등록된 댓글이 없습니다.

PHP
871 (7/18P)

Search

Copyright © Cmd 명령어 3.12.74.18