MySQL tutorials

Import CSV file directly into MySQL

Contributed by katy8439 on May 8, 2007 under MySQL

Instead of writing a script to pull in information from a CSV file, you can link MYSQL directly to it and upload the information using the following SQL syntax.

Comments
 

MySQL: Increment an exisitng value

Contributed by qmchenry on February 24, 2007 under MySQL

This slick MySQL syntax allows you to increment or decrement an existing number in a table without first having to read the value. This is a nice way to increment an access counter.

Comments
 

MySQL: Use CONCAT to include text in SELECT results

Contributed by qmchenry on January 31, 2007 under MySQL

The CONCAT function in MySQL allows SELECT statements to act like printf commands by mingling text and query results together.

Comments
 

Copy an existing MySQL table to a new table

Contributed by qmchenry on July 4, 2006 under MySQL

This is a great set of two commands that allow the creation and population of a new table with the structure and data of an existing table. This provides a quick means of making a point-in-time copy of a table and is a safe, easy way to make a quick copy of a table for testing an application in development on live data without risking a production environment.

Comments
 

Rename or change name of MySQL table

Contributed by qmchenry on under MySQL

If you change your mind and want to rename an existing MySQL table, with or without data in it, it is no problem. One simple command will change the table’s name.

Comments
 

Ignore duplicate entries in MySQL select using DISTINCT keyword

Contributed by qmchenry on July 3, 2006 under MySQL

Sometimes every occurance of a value which may be duplicated multiple times in a result set is not needed. For example, if making a pulldown menu list of options, each option should be seen only once. The DISTINCT keyword in a select statement eliminates duplication in the result set.

Comments
 

Save MySQL query results into a text or CSV file

Contributed by qmchenry on June 28, 2006 under MySQL

MySQL provides an easy mechanism for writing the results of a select statement into a text file on the server. Using extended options of the INTO OUTFILE nomenclature, it is possible to create a comma separated value (CSV) which can be imported into a spreadsheet application such as OpenOffice or Excel or any other applciation which accepts data in CSV format.

Comments
 

Get MySQL date in RFC-822 format for RSS feeds

Contributed by qmchenry on June 19, 2006 under MySQL

To get the PubDate element of an RSS feed to validate, it needs to be in RFC-822 format. MySQL has flexible ways of working with dates and times which make this a simple task.

Comments