« FJAX: Ajax with Flash | Home | Playing with Ruby »

Mysql useful tips

By Michael Stepanov | June 30, 2006

I decided to put in one post several Mysql commands and tips which I used during this week.

1. Get a table structure
To get a table structure in a SQL it can be used a command
show create table <table name> \G

2. Get ID of last inserted record.
To get the ID of the last inserted record just use mysql built-in function LAST_INSERT_ID(). Perl geeks can get the ID from DBI connection property - mysql_insertid:
my $id = $dbh->{mysql_insertid};

3. Update summary counters.
To update some counters in a table you can do following:

Topics: , |

 RSS feed for comments on this post.

Comments