Monthly Archives: January 2012

MySQL Collations in practice

Collations are important for how text is ordered by indices and ORDER BY clauses; in fact a collation defines how they work. Sadly developers seem to often ignore collations in data models, and the database default settings are used. If you are using MySQL and haven’t configured any particular collation, your database is probably sorted according [...]

The Ultimate Guide To UTF-8 and MySQL

How character encodings work in MySQL seem to continue baffle people, at least based on the number of questions posted on Stackoverflow. Read on if you have an application that still outputs funny text like “señor” or “se�or” where “señor” is expected. The truth about text in MySQL Strings in MySQL consist of an encoding [...]

Grouping data

Suppose you are faced with the task of taking a list of things and grouping them by some attribute, like turning the following list country-city pairs… input=[("USA", "New York"), ("USA", "San Francisco"), ("USA", "Los Angeles"), ("UK", "London"), ("UK", "Manchester"), ("UK", "Edinborough"), ("Spain", "Madrid"), ("Spain", "Barcelona"), ("Spain", "Granada"), ("Finland", "Helsinki"), ("Finland", "Oulu"), ("Finland", "Kuopio")] into lists of [...]