mysql存储过程

…待完善
第一步:创建数据库

CREATE TABLE IF NOT EXISTS `usertest` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(32) NOT NULL,
  `password` varchar(32) NOT NULL,
  `time` datetime NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=5 ;
INSERT INTO `usertest` (`id`, `username`, `password`, `time`) VALUES
(1, 'zhangsan', 'aaabbbccc', '2012-07-30 07:37:06'),
(2, 'lisi', 'dddeeefff', '2012-07-30 07:37:06'),

第二步:创建存储过程

DELIMITER // 
CREATE PROCEDURE ptest()
BEGIN
SELECT 'Hello Word!' AS F;
END
//  
DELIMITER ;

…待完善

Related posts:

Leave a Reply

Your email address will not be published.