简体   繁体   中英

Exporting table from sqlite3

guys! Weeks ago I exported some tables from sqlite3 database via commands in the prompt. The tables were exported in files and there were the actual sql code of creating the tables and inserting data in them. It was like this:

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE [teachers] (
  [teacherid] number(9,0), 
  [FirstName] varchar2(20), 
  [LastName] varchar2(20), 
  [office] varchar2(20), 
  CONSTRAINT [sqlite_autoindex_teachers_1] PRIMARY KEY ([teacherid]));
INSERT INTO "teachers" VALUES(1,'Jin','Bailey','8-59');

......

But when I try now to export the same table it just puts the actual data in file

1|Jin|Bailey|8-59
2|Chloe|Fry|2-18
3|Abigail|Cervantes|6-83

... I use these commands: .output filename; select * from teachers; Well my questin is how did I do the previous exporting in that way - showing the actual code of creating the table and inserting data in it?

You should be able to dump the table like so:

.output filename
.dump tablename

It'll be dumped to the current folder with the filename you specify.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM