Vorg sql blog
INSERT ... ON DUPLICATE KEY UPDATE
The other day I found out about MySQL's INSERT ... ON DUPLICATE KEY UPDATE statement. It allows you do do an INSERT when a given key doesn't exist, or to do an UPDATE statement when it does.

I have a lot of code that does a query to see if the given ID exists, and then does an INSERT or UPDATE depending on the condition. This statement should simplify such code nicely. Good thing I know about it now.

I'm not sure if this is MySQL specific or general SQL. I'm pretty firmly locked into MySQL already though, so it doesn't really matter to me.
Posted by dustin on March 6, 2006. Tagged with
| Read 1 Reply...

 

RSSMailingList: a free combination RSS feed creator and mailing list manager
For the Sillysoft Newsletter I wanted an email mailing list that also had an RSS feed of itself. This way users could subscribe whichever way they want. I didn't find anything that did what I wanted so I created my own using PHP and a MySQL database.

I mentioned it on the macsb mailing list offering to share my code. A few people seemed interested, so I cleaned it up a bunch and hereby release it as RSSMailingList!

If you want a combination RSS feed generator and mailing list manager then check it out.
Posted by dustin on April 21, 2005. Tagged with
| Read 1 Reply...

 

Importing database backups into MySQL
Reminder to self: The command to run an SQL file into MySQL is:
mysql -u USER -p DBNAME < dump.sql
More info to be found at google answers page.
Posted by dustin on April 19, 2005. Tagged with
| Read 5 Replies...

 

the MS SQL equivalent to MySQL's 'limit' command
The MS SQL eqivalent of MySQL's LIMIT clause is TOP. Example:

SELECT TOP 10 * FROM stuff;

Will return the top ten rows, effectively doing the same thing as

SELET * FROM stuff LIMIT 10;

This was found here and has been verified by me that it actually works.
Posted by dustin on February 11, 2004. Tagged with
| Read 36 Replies...

 


Tag CloudFull Archives
   

VorgTag Cloud

Vorg sql RSS feed RSS

Latest Photo
Quote of Now:
Friends
Popular Posts
Computer Games

Hey You! Subscribe to the Vorg sql RSS feed.
Or get wider media from the Vorg All Topic feed.

 
 

Members login here.
© Vorg Group.