Archives for the ‘SQL’ Category

Selecting where row value is null

By Jamsi • Dec 8th, 2006 • Category: SQL

Don’t ask me why, but I ALWAYS forget how to select results from an mSQL database where the value is null. It’s just weird.
I always try
select * from table where colname = null
or
select * from table where colname = ”
But the correct way is to select using IS NULL!
select * from table where colname [...]



MySQL error #1135: Can’t create a new thread (errno 11).

By Jonesy • Apr 13th, 2006 • Category: Linux, SQL

This error was the bane of my life for a while, and it was very hard to get a definitive answer as to what was causing it, I hope this saves you some trouble.
My website occasionally got large traffic spikes, and at the top of these peaks, I would start to see errors like these:
MySQL [...]



Download counter (Stored Procedure)

By Jamsi • Jan 17th, 2006 • Category: SQL

A stored procedure I used as a download script. You pass this procedure a parameter (filename), it checks the database if a record for this exists. If so it increments the record by one. If the record doesnt exist it creates it for you.
For this to work I used a table with two columns.
filename varchar(255)
hits [...]