Today I got asked to pull some information from a mysql database. Pretty simple, but the one minor catch was that the person asking wanted it in a spreadsheet. Thankfully this is pretty easy with mysql’s built in ‘INTO OUTFILE’ functionality.
select * from users where last_name LIKE "%smith%" order by first_name INTO OUTFILE '/tmp/result.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n'; |
This will write the file /tmp/result.csv in a format that is readable by pretty much any spreadsheet program (Excel, OpenOffice, etc). If you have any specific requirements for your file format (say you want tab separate) play around with the options until you get it just right. As you can see you can do anything you would regularly do in a sql query (joins, where clauses, ordering, etc).
And there you have it, one happy person who can access their data in their favourite program
So, I’m sure many of you have heard of RSS before, but may not know the benefits, or if you do, how to set it up. Yet another acronym, RSS stands for Really Simple Syndication and basically what it will do is allow you to subscribe to the content of a website that has a ‘feed’. Then, whenever this site is updated with new content, you will know right away. Most current browsers (Firefox, and Internet Explorer 7) have built in RSS reading capabilities under names such as Live Bookmarks or something similar. In the top right corner of the address bar you will see an icon similar to the one to the right. Clicking on this will walk you through the process of setting up an RSS feed right in your browser.