‘ MySQL ’ category archive

Using UNION in MySQL

June 04, 08 by the programmer

If you want to combine results from two select queries in MySQL you can use the “UNION” operator.

In the following examle the results from the users query and the customers query are combined and the final result will be a table with all the results.

(

SELECT

user_id, user_name

FROM

users

)

UNION

(

SELECT

user_id, user_name

FROM

customers

)

Note that the same column names must be in the select clause in both of the queries

Maximum length for MySQL Identifiers, database names, table names, columns, index…

June 01, 08 by the programmer

Those are the maximum lenght for each MySQL identifier.

You can write names longer than the values in the table below

Identifier Maximum Length (characters)
Database 64
Table 64
Column 64
Index 64
Stored Function or Procedure 64
Trigger 64
View 64
Alias 255

Easy PHP MYSQL database comparation tool

May 20, 08 by the programmer

Every programmer comes to a situation when he has to compare two databases.

This can be the development and the production database in order to synchronize them or it can be any other two databases that needs to be structurally compared.

I found a very nice and simple free tool written in PHP that does the job very well.

The tool is called mysqldiff and it is a php application. Once you install it on your server you can compare any two MySQL databases.

Check it out.

You can download the tool from here

http://www.mysqldiff.org/downloads.php