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
Dhruv2301 4 years 17 Answers 2369 views Great Grand Master 0

Answers ( 17 )

  1. /*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%’;

  2. Select name from table_name where designation =’HR’ and name like ‘M%’ ;

  3. 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.

  4. select *
    from employe_details
    where designation = ‘HR’ AND name LIKE ‘M%’;

  5. SELECT * FROM employees
    WHERE name ILIKE ‘m%’ AND designation = ‘HR’

  6. select * from employees
    where designation= ‘HR’ and lower(name) like ‘m%’

  7. select * from employees where designation=’HR’ and name like ‘M%’;

  8. SELECT *
    FROM table_name
    WHERE DESIGNATION=’HR’ AND name like ‘m%’

  9. select *
    from employees
    where designation= ‘HR’ and lower(name) like ‘m%’;

  10. select * from employees where designation=’HR’ and name like ‘M%’;

  11. select *
    from table
    where Designation = ‘HR’
    and (Name like ‘M%’ or Name like ‘m%’)

  12. select * from table where Designation =’HR’ and name like ‘M%’

  13. select *
    from employee
    where designation = ‘HR’ AND name LIKE ‘M%’;

  14. select * from employee where designation = ‘HR’ and name like ‘M%’

  15. select * from employee where name like ‘m%’ and designation = ‘HR’

  16. Select * from employee
    Where name like ‘m%’ and designation =’HR”;

  17. select * from employees where UPPER(designation)=’HR’ and lower(name) like ‘m%’;

Leave an answer

Browse
Browse