Results 1 to 6 of 6

Thread: create table!

  1. #1
    Join Date
    Feb 2004
    Location
    inida
    Posts
    62

    Thumbs up Unanswered: create table!

    hi,

    I wanna create a table by fetching columns from two other tables?
    For eg:

    table -1
    name
    age

    table -2
    part1
    part2

    I wanna create a 3rd table with the following fields
    name
    age
    part1
    part2

    Any kind of help will be appreciable?
    thanx.

  2. #2
    Join Date
    Jul 2003
    Posts
    38

    Re: create table!

    Originally posted by neema
    hi,

    I wanna create a table by fetching columns from two other tables?
    For eg:

    table -1
    name
    age

    table -2
    part1
    part2

    I wanna create a 3rd table with the following fields
    name
    age
    part1
    part2

    Any kind of help will be appreciable?
    thanx.

    CREATE TABLE T AS (SELECT T1.NAME, T1.AGE, T2.PART1, T2.PART2 FROM T1,T2 )
    /

    NOTE: If you havent given proper where condition then the resultant table data will be the cartesian joint of all the data in T1 and T2.

    regards,
    avr.

  3. #3
    Join Date
    Feb 2004
    Location
    India
    Posts
    135

    Re: create table!

    Originally posted by neema
    hi,

    I wanna create a table by fetching columns from two other tables?
    For eg:

    table -1
    name
    age

    table -2
    part1
    part2

    I wanna create a 3rd table with the following fields
    name
    age
    part1
    part2

    Any kind of help will be appreciable?
    thanx.

    Hi,

    you may give as follows :

    CREATE TABLE table3 as ( SELECT * FROM TABLE-1, TABLE-2) ;

  4. #4
    Join Date
    Mar 2004
    Posts
    50

    Re: create table!

    Originally posted by Saravanan.R
    Hi,

    you may give as follows :

    CREATE TABLE table3 as ( SELECT * FROM TABLE-1, TABLE-2) ;
    Hi Saravanan,
    Could you please explain your script.

    Thnx
    Ishan

  5. #5
    Join Date
    Feb 2004
    Location
    India
    Posts
    135

    Re: create table!

    Originally posted by ishanbansal
    Hi Saravanan,
    Could you please explain your script.

    Thnx
    Ishan
    Hi ishan,

    Table 1 : Structure and Data

    NAME AGE
    ---------- ----------
    saravanan 27
    ishan 32

    Table 2 : Structure and Data

    PART1 PART2
    ---------- ----------
    tempvalues temp

    As per neema requirement, she need a 3rd table structure format like name,age, part1,part2 from both columns from table-1 and table-2.

    For that,
    1. If she have to create the structure and data for third table.

    CREATE TABLE TABLE3 AS ( SELECT * FROM TABLE-1, TABLE-2 ) ;

    This will create a table with structure and data as cartisan joint from table-1 and table-2.

    2. If she have to create the structure from table-1 & table-2 for table-3.

    CREATE TABLE TABLE3 AS ( SELECT * FROM TABLE-1, TABLE-2 WHERE AGE < 0 ) ;

    If this condition not satisfied, It will create the STRUCTURE for third table from TABLE-1 and TABLE-2.

    Regards

  6. #6
    Join Date
    Mar 2004
    Posts
    50
    thanx Saravanan.

    Ishan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •