Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


CREATE a table from another table

Answers were Sorted based on User's Feedback



CREATE a table from another table..

Answer / narendra

select *into newtable from oldtable.

Is This Answer Correct ?    4 Yes 0 No

CREATE a table from another table..

Answer / mohammadali.info

Syntax #1 - Copying all columns from another table

The basic syntax is:

CREATE TABLE new_table
AS (SELECT * FROM old_table);


For example:

CREATE TABLE suppliers
AS (SELECT *
FROM companies
WHERE id > 1000);

Syntax #2 - Copying selected columns from another table

The basic syntax is:

CREATE TABLE new_table
AS (SELECT column_1, column2, ... column_n FROM old_table);


For example:

CREATE TABLE suppliers
AS (SELECT id, address, city, state, zip
FROM companies
WHERE id > 1000);

Syntax #3 - Copying selected columns from multiple tables

The basic syntax is:

CREATE TABLE new_table
AS (SELECT column_1, column2, ... column_n
FROM old_table_1, old_table_2, ... old_table_n);


For example:

CREATE TABLE suppliers
AS (SELECT companies.id, companies.address, categories.cat_type
FROM companies, categories
WHERE companies.id = categories.id
AND companies.id > 1000);

Is This Answer Correct ?    4 Yes 5 No

Post New Answer

More SQL Server Interview Questions

What is Sqlpaging in SqlServer 2005 ?

0 Answers   MCN Solutions,


How does SSIS(Sql Server Integration Services) deffer from DTS(Data Transformation Services)?

0 Answers   MCN Solutions,


Why is there a performance difference between two similar queries where one uses union and the other uses union all?

0 Answers  


What is the command dbcc checkdb used for?

0 Answers  


What the different components of Replication and what is their use?

0 Answers  


What is the Query of getting last 10 transaction Reports (like insert, update, Delete Data from Tabele) ?

4 Answers   Wipro,


What is difference between clustered and non clustered index?

0 Answers  


how to overcome kernel isssues

0 Answers   Fortune,


What is extended stored procedures?

0 Answers  


Assume,there are three tables in a database, Can i have both primary key and foreign key for each table in the same database?

4 Answers  


What is collation?

0 Answers  


What is spatial and temporal data?

0 Answers  


Categories