MySQL SELECT検索データ

398 ワード

構文
SELECT field1, field2 FROM table_name;

//  
CREATE TABLE `user`  (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `name` varchar(10) NOT NULL,
  `sex` tinyint(4) NOT NULL,
  `tel` char(11) NOT NULL,
  PRIMARY KEY (`id`)
)ENGINE=InnoDB DEFAULT CHARACTER SET utf8;

//      
SELECT * FROM `user`

//      
SELECT `id`, `name` FROM `user`