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

What are the parts of a function?

1 Answers  


How do I edit a procedure in sql server?

1 Answers  


Will sql server 2005 allow you to reduce the size of a column?

1 Answers  


How do I find my localdb version?

1 Answers  


What is a sql join?

1 Answers  


What are the new data types are introduced in sql 2000?

1 Answers  


Can we insert data if clustered index is disabled?

1 Answers  


What are the built in functions in sql server?

1 Answers  


What are the benefits of using stored procedures over sql statements?

3 Answers   Ness Technologies,


What are the types of table?

1 Answers  


Any one plz send me SQL Server Developer/DBA resume for 4 years experience

1 Answers  


What is the purpose of UPDATE STATISTICS?

2 Answers  


Categories