-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathdrop.sql
More file actions
29 lines (20 loc) · 670 Bytes
/
drop.sql
File metadata and controls
29 lines (20 loc) · 670 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
-- Example of dropping a column (new in SQLite 3.35.0)
-- create table
create table mytable (first_name text, last_name text, email text);
-- check schema
-- .schema mytable
-- insert dummy data
insert into mytable (first_name, last_name, email) values ('Alice', 'In Chains', 'alice@gmail.com');
insert into mytable (first_name, last_name, email) values ('Bob', 'Baker', 'bob@gmail.com');
-- format nicely
-- .mode table
-- look at the data
select * from mytable;
-- drop column
alter table mytable drop column email;
-- look at the data again (email is gone)
select * from mytable;
-- check schema again
-- .schema mytable
-- clean up table
drop table mytable;