Insert new columns with ID's decoding into existing table

1

I have a table named products, this table already has the necessary fields for its use, but now I need to include 4 more columns in it, columns that will be the description of some ID's that I have , the table structure currently looks like this:

IdProduto | IdDepto | IdSubDepto | Idmarca | IdModelo | Codigo | DescProd | Tamanho | largura

Now I need to enter the description of each ID's in this table keeping the existing fields, it should look like this:

IdProduto | IdDepto | DescDepto | IdSubDepto | DescSubDepto | Idmarca | Descmarca | IdModelo | DescModelo | Codigo | DescProd | Tamanho | largura

The columns to be inserted are: DescDepto, DescSubDept, Descrap, and DescDate

I could not visualize a possibility that could help me solve this problem.

    
asked by anonymous 07.10.2015 / 15:09

1 answer

2

You can use alter table , as mysql command:

ALTER TABLE nomedatabela ADD nomedacoluna VARCHAR(255);

And if you want to insert it after a certain column, you can use this example as another example:

ALTER TABLE nomedatabela ADD nomedacoluna VARCHAR(255) AFTER colunaanterior;
    
07.10.2015 / 15:22