Thread: SQL deleting
View Single Post
  #7  
Old 05-13-2009, 01:16 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Quote:
Originally Posted by xXziroXx View Post
It's a good thing to vacuum after dropping a table.

NPC Code:

DROP TABLE table_name
VACUUM

Actually, no it isn't, considering HD space is not vital unless Stefan says so. SQLite uses that empty space for future data, it can write to the file without having to resize it.

In SQLite if you want to drop a column you should create a backup table. If you want to drop column b in a table named spelling that has columns a, b, c, you would do:

BEGIN
CREATE TABLE spelling_bak AS SELECT a, c FROM spelling
DROP TABLE spelling
CREATE TABLE spelling AS SELECT * FROM spelling_bak
COMMIT
__________________
Reply With Quote