#1.从学生表中查询所有学生的所有信息 SELECT * FROM `student` #2.从学生表查询所有学生的学号姓名信息并分别赋予别名 SELECT StudentNo AS '学号', StudentName AS '姓名' FROM `student`; #3.从学生表中查询学号是 1012 的学生信息 SELECT * FROM `student` where StudentNo like '1012'; #4.从学生表中查询学号在 1011-1017 之间的所有学生信息 SELECT * FROM `student` where StudentNo between 1011 and 1017; #5.查询地址在北京的所有学生的学号和姓名 SELECT StudentNo AS '学号', StudentName AS '姓名' FROM `student` where Address like '北京%'; #6.查询学生表中所有姓张的学生信息 SELECT * FROM `student` where StudentName like '张%'; #7.查询学生表中所有姓张的且名字两个字的学生信息 SELECT * FROM `student` where StudentName like '张_'; #8.查询学生表中第 3 个字是‘涛’的学生信息4 SELECT * FROM `student` where StudentName like '__涛'; #9.查询学生表中包含‘辉’的学生的信息 SELECT * FROM `student` where StudentName like '%辉%'; #10.查询学生表中的姓名和号码,并用命令插入到新表 phonelist 中 CREATE TABLE `phoneList` (SELECT `studentName`, `phone` FROM `student`);
|