Answer Posted / 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 View All Answers
What is the command dbcc checkdb used for?
What is the use of for clause?
How to download and install microsoft sql server management studio express?
How many levels of sp nesting are possible?
Can you move the resources after pausing the node? : sql server database administration
What is checkpoint process in the sql server?
How many types of stored procedures are there in sql server?
How we can refresh the view?
What is scd (slowly changing dimension)? : sql server analysis services, ssas
Explain the truncate command?
What is the difference between stored procedure and user defined functions?
What can be used instead of trigger?
hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.
explain the difference between oracle- sql and sql server sql ? if both are same y we r using 2 sw.s?
Explain acid?