How do I alter and modify my existing table and add corresponding columns the values? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I alter and modify my existing table and add corresponding columns the values?

I have an existing table. I know I have to alter the table and add the values to the new column. My sql command is ALTER TABLE PRODUCT ADD PROD_CHARGE NUMERIC(30) INSERT VALUES INTO MODE(...) for example I have three existing attributes and it have values already after I added my new column in the existing table for my new column the values are given corresponding to each attribute and value for new column as well. I am stuck here because there are existing columns and I have to add values corresponding to each attribute in my new attribute. Please help thank you What I have tried: ALTER TABLE PRODUCT ADD PROD_CHARGE NUMERIC(30) INSERT VALUES INTO MODE(...)

17th Jul 2022, 2:34 AM
Knowledge Is Power
Knowledge Is Power - avatar
3 Answers
+ 2
Knowledge Is Power Instead of altering an existing table which could corrupt your existibg table, why don't you create a new table with the info you want in your new columns. By placing your information in the correct rows, you could then create a new tabke from the 2 tables, JOINING them by ID
17th Jul 2022, 2:48 AM
Rik Wittkopp
Rik Wittkopp - avatar
+ 1
@Rik Wittkopp thank you for your response but I am learning sql first time do not know sql in details yet. I have been instructed to use it this way. I am totally lost. Getting errors!!!
17th Jul 2022, 2:59 AM
Knowledge Is Power
Knowledge Is Power - avatar
0
Knowledge Is Power Can you give a example of your existing table & then what it should look like when you alter it
17th Jul 2022, 5:19 AM
Rik Wittkopp
Rik Wittkopp - avatar