How to create a table structure without copying data from a database table?

I was asked in viva "how to create a table structure without copying data from a database table?" I was sure of my answer. My answer is: `

CREATE TABLE new_table AS (SELECT *FROM old_table);

Was I right or wrong?

+3
source share
3 answers
CREATE TABLE new_table AS (SELECT * FROM old_table where 0=1);
+2
source

No. Your answer is incorrect. You can use this SQL query.

CREATE TABLE *new_table* AS (SELECT *FROM *old_table* WHERE *statement=false*);

The following is an example:

CREATE TABLE *new_table* AS (SELECT *FROM *old_table* WHERE *1=2*);

I think this will serve your purpose ...: P

+1
source
CREATE TABLE new_table AS SELECT * FROM old_table where 0=1;

where where , , 1 = 2,2 = 3..cc., ​​ , "where" false, old_table.

0

All Articles