Creating Tables Using SELECT



Creating Tables Using SELECT..

Answer / mohammadali.info

*SELECT...INTO essentially combines CREATE TABLE and SELECT in a single statement. The AS clause can be used to change the column labels and thus control the column names in the new table. The other commands in the figure show the new table's structure and contents.

-SELECT firstname, lastname, city, state
INTO newfriend
FROM friend;

-SELECT...INTO tablename can also be written as CREATE TABLE tablename AS SELECT.... The preceding query can then be rewritten as
CREATE TABLE newfriend AS SELECT firstname, lastname, city, state FROM friend.

Is This Answer Correct ?    3 Yes 1 No

Post New Answer

More SQL Server Interview Questions

Which event (check constraints, foreign key, rule, trigger, primary key check) will be performed last for an integrity check?

0 Answers  


What is the purpose of UPDATE STATISTICS?

2 Answers  


plss anybody specify tha constrian management system in dbms

0 Answers   Police Constable,


Delete duplicate rows from a table without primary key by using a single query Table Employee empname salary A 200 B 300 A 200 C 400 D 500 D 500 Output should be A 200 B 300 C 400 D 500

14 Answers  


What are the different types of backup avaible in SQL SErver

6 Answers   Emphasis, IBM,






What is difference between createstatement and preparedstatement?

0 Answers  


What is triggers and its types?

0 Answers  


What is a performance monitor?

0 Answers  


How many types of Joins in SQL Server 2005?

9 Answers   CarrizalSoft Technologies, HCL,


what are different types of raid configurations? : Sql server database administration

0 Answers  


What are the recovery models in sql server 2000?

0 Answers  


A left outer join B B right outer join A gives the same result then what is the use of two?

1 Answers  


Categories