• Programming 25.07.2009 2 Comments

    I recently tried creating a new database table only to learn a table with that name exists already.

    [me@mysql db] > CREATE TABLE log_search (
    log_search_id BIGINT UNSIGNED AUTO_INCREMENT NOT NULL
    , search VARCHAR(255)
    , created_by VARCHAR(128), created_on DATETIME)
     ENGINE=InnoDB CHARSET=utf8;
    ERROR 1050 (42S01): Table 'log_search' already exists
    [me@mysql db] > DESC log_search;
    +---------------+---------------------+------+-----+---------------------+----------------+
    | Field         | Type                | Null | Key | Default             | Extra          |
    +---------------+---------------------+------+-----+---------------------+----------------+
    | log_search_id | bigint(20) unsigned |      | PRI | NULL                | auto_increment |
    | search        | varchar(255)        |      |     |                     |                |
    | created_on    | datetime            |      |     | 0000-00-00 00:00:00 |                |
    | created_by    | varchar(128)        |      |     |                     |                |
    +---------------+---------------------+------+-----+---------------------+----------------+
    4 rows in set (0.00 sec)

    I love naming conventions!  My favorite part of programming is when I start to write a routine only to learn I already wrote it months ago in preparation for what I knew I’d be doing now.