Archive for the ‘MySQL’ Category

MySQL doesn’t allow referring to a table that’s targeted for update in a FROM clause, which can be frustrating. There’s a better way than creating endless temporary tables, though. This article explains how to update a table while selecting from it in a subquery. Recently I am assigned to update a bunch of records in [...]

This tutorial describes how to set up database replication in MySQL. MySQL replication allows you to have an exact copy of a database from a master server on another server (slave), and all updates to the database on the master server are immediately replicated to the database on the slave server so that both databases [...]

Recently I am planning to do a maintenance job on a log table and I am suppose to write a sql script that keep the latest records and delete all the legacy records. My first try is select col1, max(created_date) from <table_name> group by col1; Using the above sql, I am able to list out [...]

Show All Users in MySql

In: MySQL

26 Nov 2009

Today a colleague ask me how to obtain a full list of all users in a mysql database. The first thing come into my mind is SELECT * FROM all_users; Then I realize this is for oracle database only. The dilemma of using multiple database is sometimes you might get their syntax all mix up. [...]

Recently I am trying to compile a report from MySQL database using “order by” clause to sort the priority_no field. However I discover the result is not in order at all. Then I try to check out the data type of priority_no field and discover that it is configure as varchar. So I just use [...]

Recently I was asked to find address duplication in an MySQL table that have 3 columns: street_no., street_name, district. So the first step I took is to remove all white spaces in all those 3 fields and just store them in a temp table. INSERT INTO table2 (street_no, street_name, district) SELECT replace(table1.street_no, ‘ ‘, ”), [...]

Navicat for MySQL

In: MySQL

11 Jun 2009

Recently I have to deal with MySQL because of the project I am involved in. Since there is no phpMyAdmin provided, I got to find the alternative. At first I try to use the oracle sqldeveloper, but it only provide view only function. Then I just use Navicat for MySQL. It is a nice tool [...]


About this blog

This is a place I create just for fun and to write down some experience and notes for myself. So feel free to enjoy and drop any comments you have. I had been employed as Programmer, System Analysts, System Administrator, DBA and Project Manager. I will share some of my case study here as well. Enjoy!

 

Calendar

September 2010
M T W T F S S
« Jul    
 12345
6789101112
13141516171819
20212223242526
27282930