• SQL: selecting top N records per group, another solution

    August 21, 2012

    A while back I presented SQL: selecting top N records per group, a "give me the top 5 countries in each continent" type of query, and which used an external numbers table and a lot of tedious casting. Here's another solution I came up with (*). Still using GROUP_CONCAT (how else?), but no external table […]

  • Ways to export MySQL result set to file on client side

    August 15, 2012

    Problem: you wish to write table data to file, but you wish to do so on client side. SELECT ... INTO OUTFILE writes the file on server. What are your options on client? 1. mysql client If you have direct access from your client machine to your DB server machine, and can connect via mysql […]

  • Things that can't (and some that can) be done from within a MySQL stored routine

    August 2, 2012

    I'm doing a lot of stored routine programming lately, working on common_schema. I'm in particular touching at the extremes of abilities. Some things just can't be done from within a stored routine. Here's a list of can't be done: Cursor for SHOW statements: can't be done -- this is explicitly blocked from operating (it once […]

 
Powered by Wordpress and MySQL. Theme by openark.org