Sql Fundamental-I For OCA

Page 1

SQL Fundamental I

1

==================================================================================== //*Introduction *// ==================================================================================== select * from tab; select * from employees; select employee_id,first_name,last_name,email,department_id,salary from employees where department_id=90; select employee_id,first_name,last_name,email,department_id,salary from employees where salary >5800; select first_name,last_name from employees; ==================================================================================== //* lession 1*// //*select data from table *// =================================================================================== select * from departments; select department_id from departments; select department_id,location_id from departments; SELECT employee_id,first_name,salary as Basic,salary+300 from employees; select employee_id,first_name,last_name,salary as Basic,10*salary+200 from employees; select employee_id,first_name,last_name,salary as Basic,10*(salary+200) from employees; select employee_id,first_name,last_name,salary as Basic,salary*10/100 as DA from employees; select employee_id,first_name,last_name,salary as Basic,salary*10/100 as DA,salary*20/100 as TA from employees; select employee_id,first_name,last_name,salary as Basic,salary*10/100 as DA,salary*20/100 as TA,((salary*10/100)+(salary*20/100)+salary) as "Gross Sallary" from employees; select employee_id,first_name||job_id as "Employee",salary as Basic from employees; select employee_id,first_name || ' is a ' || job_id as "Employee" from employees; desc employees ==================================================================================== ==================================================================================== //* Lession 2*// //* select data from table with where clause *// ==================================================================================== select employee_id,first_name,last_name,job_id,department_id from employees where department_id=100; select employee_id,first_name,last_name,job_id from employees where first_name='Nancy'; select employee_id,first_name,last_name,salary from employees where salary >=3000; select employee_id,first_name,last_name,salary from employees where salary <=3000; select employee_id,first_name,last_name,salary from employees where salary between 2500 and 3500; select employee_id,first_name,last_name,salary,manager_id from employees where manager_id in(100,101,102); select employee_id,first_name,last_name,salary from employees where first_name like '%s'; select employee_id,first_name,last_name,salary from employees where last_name like '_%o'; select employee_id,first_name,last_name,salary,manager_id from employees where manager_id is null; select employee_id,first_name,last_name,salary,job_id from employees where salary >=10000 and job_id like '%MAN%'; select employee_id,first_name,last_name,salary,job_id from employees where salary >=10000 or job_id like '%MAN%'; SQL Fundamental - I


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.