Ace Your SDET SQL Interview: 10 Easy Practice Questions Quiz

  1. Selecting Data

    Which SQL statement would you use to retrieve the names of employees who work in the 'Sales' department?

    1. SELECT name FROM employees WHERE department = 'Sales';
    2. SELECT department FROM employees WHERE name = 'Sales';
    3. SELECT name FROM Sales WHERE department = 'employees';
    4. SELECT employee_name FROM employees WHERE department = 'Sales';
    5. SELECT names FROM employees IF department = 'Sales';
  2. Aggregate Function

    To find the average salary in each department, which function would you use in your SQL query?

    1. AVG()
    2. SUM()
    3. COUNT()
    4. MINIMUM()
    5. MEAN()
  3. Using JOINs

    If you want to get order details along with the customer name, which type of JOIN should connect the 'orders' and 'customers' tables?

    1. INNER JOIN
    2. CROSS JOIN
    3. LEFT OUTER JION
    4. OUTER JION
    5. FULL INER JOIN
  4. Subqueries

    Which of these SQL statements uses a subquery to find employees earning more than the average salary?

    1. SELECT name, salary FROM employees WHERE salary u003E (SELECT AVG(salary) FROM employees);
    2. SELECT AVG(salary) FROM employees WHERE salary u003E average;
    3. SELECT name FROM employees WHERE salary = ALL (salary);
    4. SELECT name WHERE salary u003E AVG(salary) FROM employees;
    5. SELECT * FROM employees HAVING salary u003E AVG(salary);
  5. Filtering with IN

    Which SQL query would you use to find names of employees who work in the 'HR' or 'Finance' departments?

    1. SELECT name FROM employees WHERE department IN ('HR', 'Finance');
    2. SELECT name FROM employees WHERE department = ('HR', 'Finance');
    3. SELECT name FROM employees WHERE department LIKE 'HR' OR 'Finance';
    4. SELECT name FROM employees WHERE department IS ('HR', 'Finance');
    5. SELECT name FROM employees WHERE department IN 'HR', 'Finance';
  6. Combining Results

    Which keyword combines results from two queries and removes duplicates, such as selecting employees from 'Marketing' and 'IT' departments?

    1. UNION
    2. MERGE
    3. COMBINE
    4. JOIN
    5. INION
  7. Conditional Output

    If you want to classify salaries as 'High' for values above 50000 and 'Low' otherwise, which SQL keyword should you use?

    1. CASE
    2. SWITCH
    3. DECISION
    4. WHEN
    5. IFTHEN
  8. Grouping and Filtering

    How do you filter groups in a GROUP BY query to only include those where the average salary is over 60000?

    1. By using HAVING AVG(salary) u003E 60000
    2. By using WHERE AVG(salary) u003E 60000
    3. By adding FILTER AVG(salary) u003E 60000
    4. By including LIMIT AVG(salary) u003E 60000
    5. By using SORT AVG(salary) u003E 60000
  9. Common Table Expressions

    What keyword is used to define a Common Table Expression (CTE) in SQL for a temporary result set?

    1. WITH
    2. TEMP
    3. NEWTABLE
    4. BEGIN
    5. DEFINE
  10. Updating Data

    To increase all salaries in the 'Sales' department by 10%, which command will correctly update the salary values?

    1. UPDATE employees SET salary = salary * 1.10 WHERE department = 'Sales';
    2. UPDATE employees ADD 10% TO salary WHERE department = 'Sales';
    3. UPDATE employees SET salary = salary + 0.10 WHERE department = 'Sales';
    4. UPDATE employees WHERE department = 'Sales' SET salary = salary 1.10;
    5. UPDATE employees salary = salary * 10% WHERE department = 'Sales';