Consider the below tables:Employee TableColumn NameDataTypeConstraintNameVarchar2(20) EmpnoNumber(10)PKsalaryNumber(10,2) Tax TableColumn NameDataTypeConstraintTaxgradeNumber LowsalNumber(10) highsalNumber(10,2) We want to create a report that displays the employee details along with the tax category of each employee. The tax category is determined by comparing the salary of the employee from the EMP table to the lower and upper salary values in the TAX table.Which SELECT statement produces the required results?Select one:a.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary >= t.lowsal AND <= t.highsal;b.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary BETWEEN t.lowsal AND t.highsal;c.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary IN t.lowsal AND t.highsal;d.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary <= t.lowsal OR e.salary >= t.highsal;
Question
Consider the below tables:Employee TableColumn NameDataTypeConstraintNameVarchar2(20) EmpnoNumber(10)PKsalaryNumber(10,2) Tax TableColumn NameDataTypeConstraintTaxgradeNumber LowsalNumber(10) highsalNumber(10,2) We want to create a report that displays the employee details along with the tax category of each employee. The tax category is determined by comparing the salary of the employee from the EMP table to the lower and upper salary values in the TAX table.Which SELECT statement produces the required results?Select one:a.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary >= t.lowsal AND <= t.highsal;b.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary BETWEEN t.lowsal AND t.highsal;c.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary IN t.lowsal AND t.highsal;d.SELECT e.name, e.salary, t.taxgradeFROM emp e, tax tWHERE e.salary <= t.lowsal OR e.salary >= t.highsal;
Solution
The correct answer is:
b. SELECT e.name, e.salary, t.taxgrade FROM emp e, tax t WHERE e.salary BETWEEN t.lowsal AND t.highsal;
This SQL statement will correctly compare the employee's salary to the lower and upper salary values in the TAX table and display the employee details along with the tax category. The BETWEEN operator in SQL is inclusive, meaning it includes the end values, making it the right choice for this scenario.
Similar Questions
Consider the following EmployeeDetails table.You want to display the details of employees whose salary is more than the lowest salary of department having ID 10.To perform this task, which of the following query you can use the
Consider a table Emp(Name, Salary)SELECT Name FROM Emp WHERE Salary BETWEEN 1000 AND 2000;The above query will display the names from the Emp table whose __________Salary is >1000 and Salary <= 2000Salary is >=1000 and Salary <= 2000Salary is >=1000 and Salary < 2000Salary is >1000 and Salary < 2000
Write queries for the following tables:T1 ( Empno, Ename , Salary, Designation)T2 (Empno, Deptno.)(1) Display the Deptno in which Employee Seeta is working.(2) Display Empno, Ename, Deptno.
Given below two tables:EmpRoom (EmpID, EmpName, Department, RoomID)(101, Tanaka, A1, 110), (102, Suzuki, A1, 111), (103, Saito, A2, 203), (104, Fukuda, A2, 201), (105, Oohira, A2, 202)RoomMgnt (RoomID, Department)(110, A1), (111, A1), (201, A2), (202, A2), (203, A2)Which are the outputs of the below SQL statement on the two tables:SELECT EmpName FROM EmpRoomWHERE RoomID NOT IN ( SELECT RoomID FROM RoomMgnt WHERE Department='A1');Saito, Fukuda, OohiraTanaka, SuzukiFukuda, OohiraTanaka, Suzuki, Saito
SELECT last_name, first_nameFROM employeeWHERE salary IN(SELECT salaryFROM employeeWHERE dept_no = 3 OR dept_no = 5);Which values are displayed?Select one:a.last name and first name of only the employees whose salary falls in the range of salaries from department 3 or 5b.last name and first name of only the employees in department number 3 or 5c.last name and first name of all employees except those working in department 3 or 5d.last name and first name of all employees with the same salary as employees in department 3 or 5
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.