harry77
harry77

Reputation: 117

Create database from existing table in sqlite

I have a table. For example: CREATE TABLE temp AS SELECT * FROM range(20)

How i can create in sqlite a new database with one command with the table temp?

Upvotes: 0

Views: 217

Answers (2)

Arun
Arun

Reputation: 951

Since your in sqlite, in the command line just type:

 sqlite3 datbase_name.db

This will create a new database called database_name.db, now to create your table to this database just type:

 sqlite3 database_name.db "CREATE TABLE .......;"

Type your create table statement inside the quotes.

For more info, please take a look at their documentation.

Upvotes: 2

Morgan Buck
Morgan Buck

Reputation: 11

I think that would depend on the DBMS but this may be what you're looking for.

COPY Command Syntax

"COPY {FROM database | TO database | FROM database TO database} {APPEND|CREATE|INSERT|REPLACE} destination_table [(column, column, column, ...)] USING query"

http://docs.oracle.com/cd/B19306_01/server.102/b14357/apb.htm

Upvotes: -1

Related Questions