본문 바로가기
리눅스

MYSQL 테이블 필드 삭제,추가 및 변경

by 웹디자인 2012. 7. 20.

MYSQL 테이블 타입
1. ISAM
2. MyISAM
3. HEAP
4. BDB

테이블 생성
===========================================
필드용도 | 필드명 | 필드 속성 | 필드길이
-------------------------------------------
회원번호 uid 숫자 4
-------------------------------------------
이름 name 숫자 12
------------------------------------------
전자우편 email 문자 20
==========================================

c:\mysql\bin>mysql -u root -p nandol
mysql>create table testtable1(
->uid int(4),
->name char(12),
->email char(20));
mysql>show tables;
mysql>desc testtable1;
=================
기존 필드에 테이블 추가하기
mysql> alter table testtable1 add column hompage char(50);
mysql> dsc testtable1;
기존 필드 속성변경하기
mysql> alter table testtable1 change column hompage home char(80);

필드 삭제하기
mysql>alter table testtable1 drop column home;
mysql>desc testtable1;
테이블 삭제하기
mysql> drop table testtable1;
mysql> show tables;

rename table 변경 전 테이블명 to 변경 후 테이블명;

예) rename table cartmts to cartdts

 

'리눅스' 카테고리의 다른 글

리눅스 메일계정 삭제하기  (0) 2012.07.20
도메인 포워딩  (0) 2012.07.20
MySQL 사용방법  (0) 2012.07.20
메일공간 주기적으로 삭제  (0) 2012.07.20
가상호스트 추가하기  (0) 2012.07.20

댓글