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 tables in sql server?

0 Answers  


How would you use user_constraints table in DB?

0 Answers   Wipro,


What does ss stand for sexually?

0 Answers  


What is user defined datatypes and when you should go for them?

0 Answers  


Why use sub query in sql server and list out types of sub queries?

0 Answers  






How will you hide an attribute? : sql server analysis services, ssas

0 Answers  


How you can get a list of all the table constraints in a database? : Sql server administration

0 Answers  


Is foreign key unique?

0 Answers  


What is candidate key with example?

0 Answers  


What is the difference between join and inner join?

0 Answers  


Where can you find the error log information? : sql server database administration

0 Answers  


List the data types available in mssql?

0 Answers  


Categories