1、查看指定字段
select column_name from table_name where condition;
2、查看全部字段
select * from table_name;
3、设置显示的格式:
(1) 字符类型只能设置显示的长度
col username format a10;
(2) 数值类型用一个’9’代表一位数字
col salary format 9999.9;
col salary format $9999.9;
(3) 清除格式
col username clear;
col salary clear;
4、给字段设置别名
(1) 把username修改为‘用户名’
col username heading 用户名
(2) 一次设置多个别名
select id as 编号,username as 用户名,salary as 工资 from users;
去掉重复的字段
select distinct username as 用户名 from users;