Showing posts with label mysql. Show all posts
Showing posts with label mysql. Show all posts

Tuesday, July 20, 2010

Top 20+ Best Mysql Pratices

This is a great article about mysql best pratices. You just must take a look.

Direct link: http://net.tutsplus.com/tutorials/other/top-20-mysql-best-practices/

Monday, July 19, 2010

MySql - Updating Duplicated Entries Made Easy

Our example table
CREATE  TABLE IF NOT EXISTS `mydb`.`Counter` (
  `idCounter` INT NOT NULL AUTO_INCREMENT ,
  `name` VARCHAR(30) NULL ,
  `hits` INT NULL ,
  PRIMARY KEY (`idCounter`)
);

Our SQL code
INSERT INTO Counter (idCounter,name, hits) VALUES (1,'myBlog',1) 
ON DUPLICATE KEY UPDATE hits=hits+1

As simple as that