1.建表语句----DDL
CREATE TABLE `月光` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`createdate` datetime DEFAULT NULL,
`username` varchar(20) DEFAULT NULL,
`pwd` varchar(36) DEFAULT NULL,
`phone` varchar(11) DEFAULT NULL,
`age` tinyint(3) DEFAULT NULL,
`sex` char(2) DEFAULT '男',
`introduce` varchar(255) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
2.插入语句----SQL
INSERT into 月光 VALUES(0,'2024-02-18 00:00:00','江若琳','1314520','15931055753',19,'女','宇宙无敌超级美女')
INSERT into 月光 VALUES(1,'2024-03-25 00:00:00','高乙磊','1314521','15931055756',19,'男','查无此人')
3.基础查询语句---DQL
SELECT * FROM `月光` WHERE username LIKE '江%';
SELECT * FROM `月光` WHERE pwd IS NULL;
SELECT * FROM `月光` WHERE pwd IS NOT NULL;
SELECT * FROM `月光` WHERE createdate BETWEEN '2024-02-18' and '2024-02-20';