In: Computer Science
Employee_id |
First_name |
Last_name |
Salary |
Joining_date |
Department |
1 |
John |
Abraham |
1000000 |
01-JAN-13 12.00.00 AM |
Banking |
2 |
Michael |
Clarke |
800000 |
01-JAN-13 12.00.00 AM |
Insurance |
3 |
Roy |
Thomas |
700000 |
01-FEB-13 12.00.00 AM |
Banking |
4 |
Tom |
Jose |
600000 |
01-FEB-13 12.00.00 AM |
Insurance |
5 |
Jerry |
Pinto |
650000 |
01-FEB-13 12.00.00 AM |
Insurance |
6 |
Philip |
Mathew |
750000 |
01-JAN-13 12.00.00 AM |
Services |
7 |
TestName1 |
123 |
650000 |
01-JAN-13 12.00.00 AM |
Services |
8 |
TestName2 |
Lname% |
600000 |
01-FEB-13 12.00.00 AM |
Insurance |
Write the following queries:
1. Get all employee details from the employee table
2.Get First_Name from employee table using alias name “Employee Name”, sorted descending
3.Get unique DEPARTMENT from employee table
4.Get employee details from employee table whose employee name are “John” and “Roy”
5.Get employee details from employee table whose employee name are not “John” and “Roy”
6.Get employee details from employee table whose first name contains 'o'
7.Get employee details from employee table whose first name ends with 'n'
8.Get employee details from employee table whose Salary between 500000 and 800000
9.Get employee details from employee table whose name is 'John' and 'Michael'
Ans:
1.select Employee_Id,First_name,Last_name,Joining_date,Department from employee;
2.select First_name as Employee Name from employee order by First_name desc;
3 select distinct Department from employee;
4.select Employee_Id,First_name,Last_name,Joining_date,Department from employee where First_name="John" or FIrst_name="Roy";
5.select Employee_Id,First_name,Last_name,Joining_date,Department from employee where First_name<>"John" and First_name<>"Roy";
6.select Employee_Id,First_name,Last_name,Joining_date,Department from employee where First_name like "%o%";
7.select Employee_Id,First_name,Last_name,Joining_date,Department from employee where First_name like "%n";
8.select Employee_Id,First_name,Last_name,Joining_date,Department from employee where Salary between 500000 and 800000;
9.select Employee_Id,First_name,Last_name,Joining_date,Department from employee where First_name="John" or First_name="Michael";