Quick note on how to do this.
I was tasked with cleaning up an english database by replacing all special alphabets (ë to e) and non-alphanumeric symbols with URL friendly characters.
- -- return all records that contain non-alphanumeric characters
- SELECT * FROM myTable WHERE myColumn NOT REGEXP '^[A-Za-z0-9]+$';
- -- return all records that are non-alphanumeric but ignore underscores
- SELECT * FROM myTable WHERE myColumn NOT REGEXP '^[A-Za-z0-9\_]+$';
So this is a quick note to myself as I was playing with the relevance heuristics of a query. This example adds a column of relevance and sorts the rows accordingly.
This has to be a real quick one for a dropdown search field which has to find relevant terms to autofill/autocomplete a search form:
- -- where @ThisSearch is a posted (and sanitized) variable
- SET @ThisSearch:="Brains";
- WHEN columnFirstName LIKE @ThisSearch THEN 20
- WHEN columnFullName LIKE @ThisSearch THEN 10
- WHEN columnLastName LIKE @ThisSearch THEN 10
- WHEN columnFullName LIKE @ThisSearch THEN 1
- END as relevance
- s.columnPublished <= NOW()
- AND (
- OR columnFullName LIKE @ThisSearch
- ORDER BY relevance DESC, columnFullName ASC
Just a quick note to myself on how to reorder columns as I was having difficulty using a phpMyAdmin interface to do this.
Taken from the best forum for programming Qs&As: http://stackoverflow.com/questions/4095481/easy-way-to-re-order-columns
So in the phpMyAdmin interface, apparently, you can drag the columns by clicking and holding on the headers when viewing a table structure... Though maybe this is derived from a template and depending on if you are using MS Internet Explorer...
Can't get it working? I use whatever is most useful and Google's Chrome is the fastest browser I have. Here are some ways to do this:
This article isn't unique as there are other tutorials out there. This is meant to detail a process to export a database using MySQL Workbench and then to import it into another database.
If you're confined to use this product then this is how to do it. Personally, even a web-based app such as PhpMyAdmin would fare better.
This is an article on how to replace a string with another in all your joomla articles without modifying other data such as modified date and author.
I used to have a third-party plugin that would replace my HTML tags <PRE> with <PRE CLASS="brush:php">. Not I want to switch these back.
For demo purposes, I'm searching a column called introtext in a database table called MYTABLE_content. First let me find all the articles that need this change: