MySQL Code Snippets

Exam code to backup MySQL Database to SQL File

30 August, 2016   

Use INTERVAL to add or subtract days.

13 June, 2016   

As a "preview" of text, this MySQL select will return the first few words out of a text field in a database. It returns entire words (doesn't cut them off in the middle) and follows the last word with an elipse "..."

Simplest way to to export a MySQL table to a pipe delimited file.

23 March, 2016   

Get contents of table where the item does NOT exist in another table.

05 November, 2015   

MYSQL code sample to replace a NULL with a given value.

12 August, 2015   

Example shows how to capitalize in MySQL.

The mysql_fetch_assoc "converts" a row from a table into an associative array. The mysql_insert_array "converts" an associative array into a row in a table.

Does url_decoding while respecting utf8 characters.

Example code to update or convert the field to UPPERCASE.

26 February, 2015   

Simple and easy mySQL code to select the row number

15 February, 2015   

Move field position while still retaining its content.

Returns the text between the specified delimiters in MySQL.

24 December, 2014   

Example shows here how to select from multiple mySQL tables.

30 November, 2014   

Mysql code example for Regular Expression SELECT statement

Mysql code example to SELECT based on a field that can have a NULL value.

06 November, 2014   

Example mysql code to select the row number

23 October, 2014   

Rebuild indexes on a mySQL table.

Returns the text between the specified delimiters in MySQL.

14 September, 2014   

Selects the minimum value of the field in the brackets.