Latest articles under Database category

MySQL : Too many connection errors.

I was trying to connect to a MySQL server at work and I got connection fail “Too many connections”. Here’s the screen shot that I took using Navicat Lite client and Sequel Pro.

I did Googling a bit and I found that most common problem is because MySQL has too many open client being connected [...]

Posted on January 23rd, 2009 under MySQL  •  10 Comments

Querying database structure.

There are times when we want to query a database structure for a particular table name. Or you want to find which tables a particular column name is defined. Or in my case, I wanted to find all tables that has column A and column B defined … how do I do it?
If you are [...]

Posted on January 15th, 2009 under MySQL  •  No Comments

MySQL Error Code 150

Error can’t create table …
I was trying to add new table and alter another table to add new column and foreign key to the new table. Here’s basically what I had

CREATE TABLE `chapters` (
`chapter_id` int(10) unsigned NOT NULL auto_increment,
`chapter_title` varchar(255) NOT NULL,
PRIMARY KEY (`chapter_id`)
);

ALTER TABLE `articles`
[...]

Posted on January 8th, 2009 under MySQL  •  1 Comment

Optimizing SQL that selects the max/min/etc from a group.

How would you like to optimize a 10 minute query down to 24 seconds? This was an optimization I had to do at work and I thought I’d share this with anyone. Even though I was using MySQL as an example, I think the technique should work on any database. Let’s say you have a [...]

Posted on January 8th, 2009 under General SQL  •  3 Comments

Page 3 of 3«123