본문 바로가기
DB/MariaDB

[MariaDB] 4. table 생성, 삭제, 변경, 복사

by 델버 2022. 12. 20.

table 생성

  1. table을 생성한다. column이 하나라도 있어야 생성되므로 column도 하나 만들어준다.
    create table tabel명 ( column명 VARCHAR(100) );
  2. table 확인
    show tab;

table 삭제

  • table 삭제
    drop table table명;

table 이름 변경

  • 이름 변경
    rename table table명 to 변경할table명;

table 복사

  • 테이블 스키마 복사
    create table new_table명 like old_table명 ;
  • 테이블 스키마 & 데이터 복사
  • create table new_table명 (select * from old_table명);
  • 데이터 복사
  • insert into receive_table명 (select * from serve_table명);

참고

https://www.codingfactory.net/11335

댓글