Category Archives: mysql
BarCamp Boston 6, April 9-10, 2011 Cambridge, MA
Make sure you don’t miss one of the best tech events of the year in the Boston Area: Barcamp Boston 6, April 9-10 in Cambridge, MA. From the site: “BarCamp Boston is Boston’s geek unconference, organized on the fly by … Continue reading
How to create a TIMESTAMP/DATETIME column in MySQL to automatically be set with the current time
The TIMESTAMP data type is the only way to have MySQL automatically set the time when a row was inserted and/or updated. DATETIME columns can’t do this. TIMESTAMP columns are identical to DATETIME columns with one important exception — they … Continue reading
MySQL Integer sizes and ranges of values – How-To Create Table example
There are 5 different integer columns, each hold integer values of different sizes. Moreover, each can be signed or unsigned. If your value can’t ever be negative (for example, for an index), then you should probably make your values unsigned. … Continue reading
How-To MySQL CREATE TABLE Example showing default values, NULL values and comments
This example shows how to set default values for each column — as well as how to allow (or not allow) NULL values in the column. By default, any column can contain NULL values. (Note that we’re also using “CREATE … Continue reading
Basic How-To Example of a MySQL CREATE TABLE command
Here’s a basic example of a MySQL CREATE TABLE command. CREATE TABLE `foo`.`example_01` ( `field_1` VARCHAR(255), `field_2` CHAR(10), `field_3` INT(10), `field_4` BIGINT(20), `field_5` DATETIME ); Notice that the ‘back tic’s on each column definition (the little ` characters) are optional … Continue reading
A Simple Example of a MySQL Stored Procedure that uses a cursor
(Save this to Del.icio.us!) What is a cursor and when should you use one? A ‘cursor’ in MySQL is essentially just the result set that’s returned from a query. Using a cursor allows you to iterate, or step through, the … Continue reading