Access the database from here:
livesql.oracle.com
select * from HR.Employees;
Select First_name, email from HR.Employees where department_id = 60;
Select distinct department_id from HR.Employees;
Select distinct Last_name, job_id from HR.Employees order by job_id;
Creating temporary column and giving it an alias
Select first_name, Last_name, job_id, salary, salary*1.2 "Diwali Bonus" from HR.Employees order by job_id;
Select first_name, Last_name, first_name||'.'||last_name||'@mycompany.com' Email_ID from HR.Employees order by job_id;
desc hr.employees
Handling Null values:
select * from HR.Employees where COMMISSION_PCT is NOT NULL;
select * from HR.Employees where COMMISSION_PCT is NULL;
select * from HR.Employees where DEPARTMENT_ID in (80,60);
select * from HR.Employees where DEPARTMENT_ID =80 OR Department_ID = 60;
select * from HR.Employees where DEPARTMENT_ID =80 AND JOB_ID='SA_REP' AND COMMISSION_PCT <=0.2;
select * from HR.Employees where DEPARTMENT_ID =80 AND JOB_ID='SA_REP' AND COMMISSION_PCT <=0.2 Order by First_name
select * from HR.Employees where DEPARTMENT_ID =80 AND JOB_ID='SA_REP' AND COMMISSION_PCT <=0.2 Order by First_name DESC;
select * from HR.Employees where DEPARTMENT_ID =80 AND JOB_ID='SA_REP' AND COMMISSION_PCT <=0.2 Order by 4 DESC;
select * from HR.Employees where DEPARTMENT_ID =80 AND JOB_ID='SA_REP' AND COMMISSION_PCT <=0.2 Order by HIRE_DATE, First_name DESC, 4;
select * from HR.Employees Order by COMMISSION_PCT NULLS FIRST, First_name;
select * from HR.Employees Where Department_ID BETWEEN 40 and 80 Order by Department_ID;
---------------------
OPERATORS
---------------------
*,/,+,-
||
NOT
= <= < >= >, IN, LIKE - WHERE
AND
OR
Comments
Post a Comment