[Database] I want to create a new table with two different tables and add a property (vertical) value.

Asked 1 years ago, Updated 1 years ago, 133 views

I have extracted only the necessary attribute values from the table A and the table B (extracted by Join I would like to make a table by adding extraction as join + new name/other to the new C table.

-------- Extract with A and B table join------

select "Aname","Bname","Aage","Bage" from "A" Inner join "B" on "A"."Akey"=2 and "B"."Bkey"=3;

If the result is as above, in C table,

I want to make it like this. I extracted it as a join and even made a C table with a create statement, but I'm asking you because I think there's another way to bring the value one by one.

database sql join table postgresql

2022-09-21 16:24

1 Answers

Make Table A, Table B, and Table C

Table A (Default key, name, age, ...) Table B (B Primary Key, Name, Age, ...) Table C (Default key, Name, School, Table A.Default key, Table B.Default key, ...)

When you make it and print it out,

Table C Name | Table C School | A. Name | B.Name | A. Age | B.Age

insert into table C values (?, ?, ?, ?, ?, ??); So, I'm going to put the C value in mapping, and the rest of the values referring to A and B tables as joins.


2022-09-21 16:24

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.