Why does MySQL return # MySQL returned an empty result set (i.e. zero rows). and 3 row(s) affected.? Is there anything wrong in my SQL statements?
CREATE TABLE IF NOT EXISTS `test` (
`id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`order` mediumint(8) NOT NULL,
`url` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
`title` varchar(70) COLLATE utf8_unicode_ci NOT NULL,
`content` text COLLATE utf8_unicode_ci,
PRIMARY KEY (`id`),
UNIQUE KEY `url` (`url`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;
# MySQL returned an empty result set (i.e. zero rows).
INSERT INTO `test` (`id`, `order`, `url`, `title`, `content`) VALUES
(52338, 1, '', 'Home', 'content'),
(70104, 2, 'about', 'About', 'content'),
(27034, 3, 'portfolio', 'Portfolio', 'content');
# 3 row(s) affected.
The number of affected rows and the length of the result set are two different things.
Generally, INSERT, UPDATE and DELETE statements affect rows, while SELECT returns a result set which may be empty if no rows were matched according to the condition.