Mysql Table Snippets


If you have a database driven site and you want to optimize MySQL tables then this is perfect. It goes through all the tables in a MySQL database and does table optimization on each one using the MySQL Optimize Table syntax.

16 March, 2014   

How to create mysql table using php. The php script as follows as:

In this example we will select everything in our table "example" and put it into a nicely formatted HTML table.

23 October, 2012   

MySQL code example for sorting data in a GRID

23 November, 2013   

Lets say you have a table with field called "tags" that consists from tags separated by commas and you want to check whether it includes a required tag. Here the simplest ways of doing that.

22 December, 2012   

How to update random dates in MYSQL table

22 February, 2018   

MySQL Code Snippets to Export Table to File CSV

If we wanted to select only certain entries of our table, then we would use the WHERE clause .

23 October, 2014   

Rebuild indexes on a mySQL table.

In order for this to work, you will need to copy mysqldump.exe and mysql.exe from the MySQL bin Program Files folder into the same directory as your executing PHP script. If you know the direct path to these for your server, you can use those instead.

14 May, 2011   

This is a general code to use when updating an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. Note: This code requires you to connect to the MySQL database to work. Also, all field and table names need to be set up to match.

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

09 May, 2011   

This is a general code to use when inserting an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. An extention of this code would be to make sure the entry you are adding to the database doesn't already exist (to save dupicate entries). Note: This code requires you to connect to the MySQL...

22 December, 2012   

How to select a random row in MySQL

14 May, 2011   

This is a general code to use when deleting an item from a MySQL database. This code isn't considered definitive and can be written in many varied ways. A variation of the code would be not to delete the record (as you tend to always need to restore or retrieve it sooner or later) you can add a 'status' field. If status='d' then it is...

23 October, 2012   

MySQL code example to optimize all tables of database

MySQL MATCH() function performs a natural language search for a string against a text

29 July, 2013   

Selecting a Random Row from Table in MySQL

19 May, 2012   

Example code to load CSV back into mySQL

11 July, 2013   

Help manage mysql database common task