
Sometimes it's useful to create a backup table before doing a datas update in a SQL script.
But if this script must be run frequently, the table must be timestamped. However, it's not possible to create a table using a function (as CREATE TABLE MyTable_CURDATE()).
To do this, the usage of Prepared Statements is really useful :
Remember that is possible to create backup table from different ways :
1st method :
2nd method :
The first method is longer because of backup table indexes creation, this one inherits those of the original table. So, the insert command force to calculate indexes during the process.
The second one creates a new table with the same structure without indexes, so inserts are quicker. It's better to add indexes at the end of the backup.
Articles similaires
| Comments |
|














