Ignore duplicated column in MySQL table

I have a MySQL table like this

Balance Sheet  2019      2018 Assets         1000.5    960.0 Liabilities    503.4     400.1 

Let’s say I want to add to that table the following columns

2018    2017 960.0   1000.0 400.1   320.3 

How can I ignore the column that is already in the table and only add the new one?

Add Comment
1 Answer(s)

Try changing / creating that table with the following columns

CREATE TABLE IF NOT EXISTS `yourTableName`  (   `Balance Sheet` varchar(4)  NOT NULL ,   `Assets`  decimal(20,1) NOT NULL,   `Liabilities` decimal(20,1)  NOT NULL ,    PRIMARY KEY (`Balance Sheet`) ); 

make balance sheet column as primary key or unique index. Thereby new row entries with same year value would be flagged as duplicates.

Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.