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

wat is the main diff between sql server 2000and sql server 2005

6 Answers   Jade Software,


What are the new scripting capabilities of ssms? : sql server management studio

0 Answers  


What is ms sql server index?

0 Answers  


What is difference between inner join and full join?

0 Answers  


What methods do you follow to protect from sql injection attack?

0 Answers  






What is data source view or dsv? : sql server analysis services, ssas

0 Answers  


explain different types of backups avaialabe in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration

0 Answers  


Can we add our custom code in ssis?

0 Answers  


Difference between Inner vs outer joins?

0 Answers  


What are the differences between triggers and stored procedures?

0 Answers  


What does select 1 mean?

0 Answers  


What is the contrast between sql and mysql?

0 Answers  


Categories