I have millions of records in mysql database. My table structure is as follows:
Table name: Records
ID Records
53468290 Printing Multiple Photos on One Page
53438718 Printing embedded charts on a full page
53442132 Printing and Page Setup Options
53427822 Printing a Web Page 36
53462121 Printing a Single Address Label (Or a Page of the Same Label)
53470574 Printing a Single Address Label (Or a Page of the Same Label)
53462164 Printing a Single Address Label (Or a Page of the Same Label)
53433527 Printing a Single Address Label (or a Page of the Same Label)
53442687 Printable CNC Machining, 1st Edition page 99 al
53442686 Printable CNC Machining, 1st Edition page 98 555
53442685 Printable CNC Machining, 1st Edition page 97
53442684 Printable CNC Machining, 1st Edition page 96
I want to delete only those records which have at least one numeric character after the word "page". In other words I want to delete records which contains "page 100" , "page 1", "page 25 L" , "page 25 5"and so on.
Thank you
CodePudding user response:
Use REGEXP
:
DELETE
FROM yourTable
WHERE Records REGEXP '\\b[Pp]age\\s \\d';
The above is for MySQL 8 , for earlier versions use: REGEXP '[[:<:]][Pp]age[[:space:]] [0-9]'