Dynadot Aftermarket: discover domain gems worth investing in. Visit our aftermarket.

SQL Syntax for deleting entries

SpaceshipSpaceship
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
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
Close
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
Close
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
Close
just use this:
Code:
DELETE FROM `Domains2` WHERE CHAR_LENGTH(domainNames)<1
 
0
Close
CatchedCatched

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

Filters for activity feeds
Your news feed, Latest activity, and the activity tab on profiles now have filter buttons: All, Posts, Quick replies, and Other. Your...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back