abstract://插入数据INSERT INTO `user` (`name`, `sex`, `age`, `email`, `password`, `status`, `create_time`) VALUES ('金庸', '0', '90', 'email@php.cn', sha1(123456), '1', '1
//插入数据
INSERT INTO `user` (`name`, `sex`, `age`, `email`, `password`, `status`, `create_time`) VALUES ('金庸', '0', '90', 'email@php.cn', sha1(123456), '1', '1548656957');
//简化插入数据
INSERT `user` VALUES (null,'林清玄', '1', '90', 'email@php.cn', sha1(123456), '1', now()),(null,'唐伯虎', '1', '90', 'email@php.cn', sha1(123456), '1', now())
//更新语句
UPDATE `user` SET `age` = 78,`email` = 'php@php.cn' WHERE `id` = 20
//查询
SELECT * FROM `user`;
SELECT `name`,`age` FROM `user`;
SELECT `name`,`age` FROM `user` WHERE status = 1 ORDER BY `age` LIMIT 2;
//SELECT计算
SELECT 20*30 AS result;
//字符串拼接
SELECT concat('*',`id`,`name`) AS `user_info` FROM `user` WHERE `status` =1;
SELECT concat_ws('*',`id`,`name`) AS `user_info` FROM `user` WHERE `status` =1;
SELECT COUNT(*) AS res FROM `user` WHERE status =1
//删除
DELETE FROM `user` WHERE `id`=16
//主键排序
truncate table `user`
//主键排序
ALTER TABLE `user` DROP `id`;
ALTER TABLE `user` ADD `id` int(6) PRIMARY KEY NOT NULL AUTO_INCREMENT FIRST;
Correcting teacher:查无此人Correction time:2019-01-28 15:34:41
Teacher's summary:作业完成的不错。我好像没教mysql函数,自学的?不错,继续加油。