Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Java: generate CREATE TABLE code from an existing table

Tags:

java

sql

derby

is there a way to generate the CREATE TABLE code from an existing table in a Derby database? Or a simple way to gather the necessary table information?

like image 592
Alberto Avatar asked Feb 05 '11 15:02

Alberto


2 Answers

You can try using the dblook tool to dump an Apache Derby database table into a sql file.

like image 156
Johan Sjöberg Avatar answered Oct 22 '22 05:10

Johan Sjöberg


If you just want the CREATE-statement to recreate the table, this works for me:

CREATE TABLE new_table AS SELECT * FROM old_table WITH NO DATA;

But this does not help if you really want the CREATE-statement for some other purpose than creating a similar table.

like image 41
Boris Avatar answered Oct 22 '22 05:10

Boris