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

How to Upsert on Application-Time Periods?

Hi,

I have table Application-Time Periods (https://mariadb.com/kb/en/application-time-periods/)

for example: CREATE TABLE Employees ( id INT UNSIGNED, name VARCHAR(255) not null, position VARCHAR(255) not null, age INT not null, annual_salary decimal(10, 2) not null, date_start DATE, date_end DATE, PERIOD FOR valid_period(date_start, date_end) ) ;

regular update will be for Application-Time Periods will be:

UPDATE Employees FOR PORTION OF valid_period FROM DATE '2019-03-01' TO DATE '9999-12-31' SET age = 34, position='Pre Marketing' WHERE id = 1;

How can i use INSERT ON DUPLICATE KEY UPDATE (Upsert) (https://mariadb.com/kb/en/insert-on-duplicate-key-update/) to Insert or update?

Regards, Gonen.

Answer Answered by Daniel Black in this comment.

Gonen, thanks for your question.

I'm a bit confused as to what an INSERT ON DUPLICATE KEY UPDATE is meaning in your question without any primary or unique keys on Employees. Assuming id is a primary key I think I see a requirement.

Currently this syntax isn't supported. Please create a task on https://jira.mariadb.org.

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.