oracle之基本的sql_select语句全

查看表有哪些列

desc employees;

运行结果

 

基本sql语句

查询全部列

查询特定列

注意事项

算数运算符

查询伪表

select 8*4 from dual

运行结果

--查询十二个月的工资并+1000
select last_name,salary,12*salary+1000 from employees

运行结果


--查询日期
select sysdate,sysdate+1,sysdate-2 from dual;

运行结果

空值 

--查询算上奖金率的月工资
select employee_id,salary,commission_pct,salary*(1+commission_pct) from employees;

运行结果

列取别名

--列取别名
select employee_id id,last_name name,12*salary from employees

运行结果


--列取别名 大小写
select employee_id as "Id",last_name name,12*salary from employees

运行结果

连接符

--连接符
select last_name||'`s job_id is'||job_id from employees

运行结果

重复行

--重复行
select distinct department_id from employees;

运行结果

sql和sql plus区别

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章