'How to change the query so that it checks if the table is not empty
I've got a query:
INSERT INTO rates (name, value, time)
SELECT name, value, time
FROM updated_rates
ON CONFLICT (name) DO UPDATE
SET value = excluded.value, time = excluded.time;
TRUNCATE updated_rates;
How to change the query so that it does the actions above if updated_rates is not empty
Solution 1:[1]
If the table is empty, the query will just "do nothing". There is no need in adding anything to the query for it to work properly
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | heck20112356 |
