备份数据库:
输入quit推出mysql,在cmd.exe中输入:
Mysqldump –u用户名 –p密码 数据库名 >文件名
恢复数据库:
进入mysql.exe之后,使用数据库之后
Source文件名
Select【distinct】列明【列名】。。from表明
注意事项:
*可以替代列明,表示所有列,但是通常我们为了提高代码的可读性,不实用*
Distinct为过滤重复记录
如果distinct后面跟多列,是过滤掉多列合并之后的重复
列名表达式
语法
select 列明|表达式【列名|表达式】。。。from表名
注意事项
表达式只是显示时起作用,不会改变数据库中的值
AS select列名 AS 别名 From 表名
Where
语法
Select列名 from 表名【where 条件语句】
练习
1.查询英语分数在80—90分之间的
Select name English from student where English>=80 and English
<=90
2.查询除了姓张和姓李的学生总分
Select name English math Chinese from student where name not “张%”and name not like “李%
Order by
语法
Select 列名 from 表名 order by 列名 asc|desc
练习
对数学成绩排序后输出
Select name math student order by math”