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

explain different levels of normalization? : Sql server database administration

0 Answers  


Can we move Resource database from one path to another? If yes,How can we?

1 Answers   Wipro,


How to create a large table with random data for index testing in ms sql server?

0 Answers  


How to stop a loop early with break statements in ms sql server?

0 Answers  


What is ms sql server service broker?

0 Answers  






How to delete an attribute from the emp table

4 Answers  


Determine when an index is appropriate?

0 Answers  


What is outer join in sql server joins?

0 Answers  


Explain the difference between functions and stored procedures in sql server?

0 Answers  


What is the difference between Triggers and Stored Procedure?

0 Answers   HCL,


how can you check the level of fragmentation on a table? : Sql server administration

0 Answers  


Explain for xml explicit mode?

0 Answers  


Categories