You can't do this with SQLite, because it does not support dropping columns. This is a documented limitation (emphasis mine):
Only the RENAME TABLE
, ADD COLUMN
, and RENAME COLUMN
variants of the ALTER TABLE
command are supported. Other kinds of ALTER TABLE
operations such as DROP COLUMN
, ALTER COLUMN
, ADD CONSTRAINT
, and so forth are omitted.
A possible workaround is to recreate another table with the correct structure, then copy the data, drop the old table and rename the new table:
create table autor_new (
id integer primary key,
nome text,
cidade text,
estado text,
telefone text
);
insert into autor_new select id, nome, cidade, estado, telefone from autor;
drop table autor; -- back it up first!
alter table autor_new rename to autor;