Dino Geek, try to help you

How to remove duplicate records in MariaDB?


Removing duplicate records in MariaDB can be achieved using several different methods. Here are a few simple steps using one such method:

1. Create a new table with the same structure, but no indexes or keys:

\`\`\` CREATE TABLE sort_table LIKE original_table; \`\`\`

1. Insert rows from the original table into this new table, but group them to avoid duplicates:

\`\`\` INSERT INTO sort\_table SELECT \* FROM original\_table GROUP BY column1, column2; \`\`\` Replace `column1, column2` with the columns by which you want to group. This operation will select only distinct records.

1. Drop the original table:

\`\`\` DROP TABLE original\_table; \`\`\`

1. Rename the new table to the name of the original table:

\`\`\` RENAME TABLE sort_table TO original_table; \`\`\`

1. If the original table had indexes or keys, don’t forget to recreate them on the renamed table.

Warning: Always backup your data before performing such operations, as they can lead to data loss if not executed correctly!


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use