1、制表
CREATE TABLE `student` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '学号',
`createDate` datetime DEFAULT NULL COMMENT '创建时间',
`userName` varchar(20) DEFAULT NULL COMMENT '姓名',
`pwd` varchar(36) DEFAULT NULL COMMENT '密码',
`phone` varchar(11) DEFAULT NULL COMMENT '手机号',
`age` tinyint(3) unsigned DEFAULT NULL COMMENT '年龄',
`sex` char(2) DEFAULT NULL COMMENT '性别',
`introduce` varchar(255) DEFAULT NULL COMMENT '简介',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8;
2、模糊查询and范围查询
SELECT * from student where introduce like '%天%';
SELECT * from student where age BETWEEN 150 and 200
SELECT * from student where createDate between '2024-02-22 00:00:00' AND '2024-02-25 11:00:00'
SELECT * from student where userName like '%李增%'
SELECT * from student where userName in ('李增志')
SELECT * from student where introduce in ('开天辟地第一人。','先天八卦')
标签:语句,COMMENT,DEFAULT,查询,student,MYSQL,NULL,where,SELECT
From: https://blog.csdn.net/2302_80152430/article/details/137101604