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...


what command is used to create a table by copying the
structure of another table including constraints ?

Answers were Sorted based on User's Feedback



what command is used to create a table by copying the structure of another table including constra..

Answer / a.jyothsna

I know copying the structure of one table but not the
constraints also:
create table newtablename as
select * from oldtablename;

with the above query total data will also be copied.
But to copy only the structure.

create table newtablename as
select * from oldtablename
where 1=2;

Is This Answer Correct ?    20 Yes 6 No

what command is used to create a table by copying the structure of another table including constra..

Answer / saurabh agrawal

We can only copy the structure of the table and not the
constraints.
Syntax is as below:
Create table newtablename as select * from oldtablename;

In this way only NOT NULL constraint specified on any
column of the OLDTABLE will automatically get copied into
the NEWTABLE but other constraint will have to be created
manually.

Is This Answer Correct ?    11 Yes 1 No

what command is used to create a table by copying the structure of another table including constra..

Answer / ben

crete view (view_name) as
select * from (table);

In SQL, a view is a virtual table based on the result-set of an SQL statement.

A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real tables in the database.

i think this is the right answer

:)

Is This Answer Correct ?    1 Yes 1 No

what command is used to create a table by copying the structure of another table including constra..

Answer / anksuh

SELECT TOP 0 * INTO employee2 FROM dbo.employeedtls
using this command we can copying the structure of one table

Is This Answer Correct ?    0 Yes 0 No

what command is used to create a table by copying the structure of another table including constra..

Answer / selvaraj v , anna univ coe

To Use same database :
======================

CREATE TABLE NEW_TBLNAME AS SELECT * FROM OLD_TBLNAME WHERE
1=2;


EXAMPLE :
---------
CREATE Emp_tbl2 AS SELECT * FROM Employee_Tbl1 WHERE 1=2;

Table creation From One USER To Another USER :
======================================================

COPY FROM coeot1a2/coeot1a2@coeau TO scott/tiger@server1
CREATE s11 USING SELECT * FROM major_List;

coeot1a2 ----> USER NAME
coeot1a2 ----> PASSWORD
coeau -------> SERVER NAME
scott -------> Another USER NAME
tiger -------> Another User PASSWORD
server1 -----> Another SERVER NAME

Is This Answer Correct ?    1 Yes 6 No

what command is used to create a table by copying the structure of another table including constra..

Answer / thirumal

select * into <new table name> from < old tablename> where
<any false condition>
ex: new table name "emp"
Old table name "dept"
select * into emp from dept where 2=5
then it will display only the structure of the old
table,not the data

Is This Answer Correct ?    3 Yes 15 No

Post New Answer

More SQL PLSQL Interview Questions

What is the maximum number of triggers,can apply to a single table?

2 Answers  


Which is better stored procedure or query?

0 Answers  


What is the difference between join and union.

27 Answers   3i Infotech, ABC, Oracle, Polaris, TCS, XT Global,


What is the unique index?

0 Answers  


how to drop an existing view in mysql? : Sql dba

0 Answers  


What are the different datatypes available in PL/SQL?

0 Answers  


what is difference b/w pravite procedures and public procedures?

3 Answers   Steria, Wipro, Zensar,


What is CYCLE/NO CYCLE in a Sequence?

2 Answers  


What is the mutating table and constraining table?

0 Answers  


Can we call a function containing dml statements in a select query?

0 Answers  


i don't want the message as 14 rows updated just it should update what it will do

4 Answers  


How do I save the results of sql query in a file?

0 Answers  


Categories