Database

[SQLite3] 컬럼 추가 / 삭제

Bonita SY 2021. 1. 29. 20:36
728x90
반응형

컬럼 추가

alter table mytable add column new_column;

ex)

alter table user add column address text;

 

http://www.devkuma.com/books/pages/1277

 


컬럼 삭제

BEGIN TRANSACTION;
CREATE TEMPORARY TABLE t1_backup(a,b);
INSERT INTO t1_backup SELECT a,b FROM t1;
DROP TABLE t1;
CREATE TABLE t1(a,b);
INSERT INTO t1 SELECT a,b FROM t1_backup;
DROP TABLE t1_backup;
COMMIT;

이 예제를 참고하여 수행

728x90
반응형