SQL Query | Level – Basic 4

Question

How can you create an empty table from an existing
table?
Suppose the name of existing table is student and new table is studentcopy

in progress 0
Ritika Sohal 55 years 2 Answers 1015 views Member 0

Answers ( 2 )

  1. Assumption:
    A is an already existing table.

    Create table B
    as select * from A
    where 1=2

  2. To create an empty table from existing table , we just have to give any false condition in the SELECT query , so that it will fail to fetch the records and create copy of the table only , not copy the data

    CREATE TABLE studentcopy
    AS SELECT * FROM student
    WHERE 2 > 3

Leave an answer

Browse
Browse