Interviews3 answers
What command is used to create a table by copying the structure of another table?
Pradeep
Posted Aug 18, 2009, 9:01 PM EDT3 Answers
SELECT * INTO New Table FROM Exiting table
SELECT * INTO mytable from HumanResources.Employee
umashankar sahuPosted Dec 19, 2012, 4:45 AM EST
We can use :
SELECT Column_list INTO New_Table_Name FROM Original_Table_Name
Ex:
select * into customers1 from cusotmers
Thank you
yakoob pashaPosted Jul 29, 2010, 6:46 AM EDT
CREATE TABLE As SELECT Command.
Explanation:
To copy only the structure the where clause of the SELECT command should have a FALSE statement.
Ex:
CREATE TABLE newtable as SELECT * FROM exixtingtable
WHERE 1 = 2
If WHERE condition is true then all the rows satisfying the condition will be copied to the newtable.
Explanation:
To copy only the structure the where clause of the SELECT command should have a FALSE statement.
Ex:
CREATE TABLE newtable as SELECT * FROM exixtingtable
WHERE 1 = 2
If WHERE condition is true then all the rows satisfying the condition will be copied to the newtable.
Priyadarshi DattaPosted Oct 31, 2009, 10:55 AM EDT