Copy Mysql table to another table I have two tables spider.expedient and spider 367.expedient, I want to copy the data from the spider.expedient table to the spider_367.expedient table daily, respecting the data from the previous day and ignoring possible duplicates.

I have run this query but it gives me error by duplicates. Is the correct way to achieve this?

INSERT INTO spider_367.expedient SELECT * FROM spider.expedient
There are two approaches that generally work well.

Option 1: add a clause to make an ineffectual change when duplicates are found:

INSERT INTO spider_367.expedient
SELECT * FROM spider.expedient
ON DUPLICATE KEY UPDATE x=x


Replace x with one of your field names.

Option 2: do a left join and only insert the records that don't match

INSERT INTO spider_367.expedient
SELECT x1.* FROM spider.expedient x1
LEFT JOIN spider_367.expedient x2 ON x1.id = x2.id
WHERE x2.id IS NULL


Replace x1.id and x2.id with your key fields.