1. Get rid of all advertisements and get unlimited access to documents by upgrading to Premium Membership. Upgrade to Premium Now and also get a Premium Badge!

How to copy just one data from the column or row?

Discussion in 'SQL PL/SQL' started by monkey, Jun 8, 2014.

  1. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    Hello!
    Please, when creating a table, how to copy just one data (not the whole column) from another column from another table?

    Many thanks!!!
     
  2. monkey

    monkey Long Term Member

    Messages:
    156
    Likes Received:
    0
    Trophy Points:
    230
    table student
    id name surname
    1 a A
    2 c C
    3 b B

    create table fbplayer(
    id int,
    nm number,
    surname varchar2(...)
    );

    insert into fbplayer( surname) values (select student.surname from student where student.id=3);

    would sth like this be ok?

    I appologise, no acces to oracle db while weekend!

    http://stackoverflow.com/questions/25969/sql-insert-into-values-select-from

    MANY THANKS!!!
     
  3. jagadekara

    jagadekara Forum Guru

    Messages:
    1,126
    Likes Received:
    145
    Trophy Points:
    1,805
    Location:
    Pulivendula
    insert into fbplayer( surname) (select student.surname from student where student.id=3);

    there remove VALUES keyword
     
    monkey likes this.