Lowe’s Interview Questions | Query I
Question
Name | Designation | Joining_Date | Salary |
Ashutosh Singla | HR | 2019-12-15 | 80,000 |
Chandan Garg | Admin | 2019-10-09 | 60,000 |
Himanshi Kaur | HR | 2019-03-13 | 75,000 |
Mohit Dharm | HR | 2019-05-27 | 85,000 |
Meena Batra | Accountant | 2019-07-11 | 50,000 |
Omkar Singh | Accountant | 2019-01-05 | 45,000 |
Pratham Garg | Admin | 2019-05-27 | 65,000 |
Rakesh Sharma | HR | 2018-06-30 | 75,000 |
Sharadha Gupta | Accountant | 2019-09-18 | 50,000 |
Demonstrate how to write a query to show details of an HR whose name starts with M.
in progress
1
SQL
55 years
17 Answers
2659 views
Great Grand Master 0
Answers ( 17 )
/*We use Like Operator, It will help us to match with the specific pattern. In the Below Query, I have used Subquery in which Inner Query selects the Names whose Designation is HR , The outer query Filter the names using Like operator whose name starts with M.*/
Select Name from ( Select Name from Table where Designation =’HR’)
where Name like ‘M%’;
Select name from table_name where designation =’HR’ and name like ‘M%’ ;
select *
from table_name
where designation = ‘HR’ AND name LIKE ‘M%’;
here the question is to retrieve all the details so we have to select all instead of selecting names only.
select *
from employe_details
where designation = ‘HR’ AND name LIKE ‘M%’;
SELECT * FROM employees
WHERE name ILIKE ‘m%’ AND designation = ‘HR’
select * from employees
where designation= ‘HR’ and lower(name) like ‘m%’
select * from employees where designation=’HR’ and name like ‘M%’;
SELECT *
FROM table_name
WHERE DESIGNATION=’HR’ AND name like ‘m%’
select *
from employees
where designation= ‘HR’ and lower(name) like ‘m%’;
select * from employees where designation=’HR’ and name like ‘M%’;
select *
from table
where Designation = ‘HR’
and (Name like ‘M%’ or Name like ‘m%’)
select * from table where Designation =’HR’ and name like ‘M%’
select *
from employee
where designation = ‘HR’ AND name LIKE ‘M%’;
select * from employee where designation = ‘HR’ and name like ‘M%’
select * from employee where name like ‘m%’ and designation = ‘HR’
Select * from employee
Where name like ‘m%’ and designation =’HR”;
select * from employees where UPPER(designation)=’HR’ and lower(name) like ‘m%’;