This is a read-only copy of the MariaDB Knowledgebase generated on 2024-11-15. For the latest, interactive version please visit https://mariadb.com/kb/.

Table and Column

I have created a new table called 'B' using a table called 'A'. My question is, how do I create three new columns in table B and populate them with data from table A? Your help would be greatly appreciated. Thank you in advance. (See example below)

Ex.tables--- A ------------ B columns a, a1, a2... b , b1, b2... c, c1, c2... x, y, z, a b c a1 b1 c1 a2 b2 c2 . . . a8 b8 c8 Put all of the data from a...a8 into column x line by line Put all of the data from b..b8. into column y line by line Put all of the data from c...c8 into column z line by line

Answer Answered by Daniel Black in this comment.

how do I create three new columns in table B

alter-table

and populate them with data from table A?

INSERT ... SELECT... FROM A

Content reproduced on this site is the property of its respective owners, and this content is not reviewed in advance by MariaDB. The views, information and opinions expressed by this content do not necessarily represent those of MariaDB or any other party.