Perhaps one of the most common things you'll be asked to do, especially if you are building a complex application that may have users, products, orders, and various other metrics is to provide some sort of reporting of that data. Perhaps you'll be asked to generate a CSV file, and the following sections show how you do it.
Firstly, we need to create a table and enter some example data so that you'll see some data in the CSV format, so with that in mind, copy the following code into SQL:
CREATE TABLE IF NOT EXISTS `users` ( `user_id` int(11) NOT NULL AUTO_INCREMENT, `user_first_name` varchar(125) NOT NULL, `user_last_name` varchar(125) NOT NULL, `user_email` varchar(255) NOT NULL, `user_created_date` int(11) NOT NULL COMMENT 'unix timestamp', `user_is_active` varchar(3) NOT NULL COMMENT 'yes or no', PRIMARY KEY (`user_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; INSERT INTO `users` (`user_first_name`, `user_last_name...