NameSilo

SQL Syntax for deleting entries

Spaceship Spaceship
Watch

freeflow

Established Member
Impact
13
I would like to clean up my database, but I need some help with the syntax for the SQL commands.

Table: Domains2
Column: domainNames
Column: status

1. How can I delete duplicate entries? (domainNames)
2. How can I delete all entries with 1 – 3 letters? (domainNames)
3. How can I delete all entries that have the status “CLIENT UPDATE PROHIBITED”? (status)

Thanks for your help.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Remember to backup your database before trying this out.

For 1 just add a unique index on the domainNames column.

For 2 use:
Code:
DELETE FROM `Domains2` WHERE CHAR_LENGTH(domainNames)<4

For 3 use this:
Code:
DELETE FROM `Domains2` WHERE status LIKE '%CLIENT UPDATE PROHIBITED%'
 
0
•••
sote said:
For 2 use:
Code:
DELETE FROM `Domains2` WHERE CHAR_LENGTH(domainNames)<4

Thanks for your help. Code number 2 is not deleting the entries with
three or less characters. Is it case sensitive?
 
0
•••
just use this:
Code:
DELETE FROM `Domains2` WHERE CHAR_LENGTH(domainNames)<1
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back