Knowee
Questions
Features
Study Tools

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

Question

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

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

The output of the given SQL statement would be "Saito, Fukuda, Oohira".

Here's the step by step explanation:

  1. The subquery (SELECT RoomID FROM RoomMgnt WHERE Department='A1') returns the RoomIDs that belong to department 'A1'. From the RoomMgnt table, we can see that these are 110 and 111.

  2. The main query (SELECT EmpName FROM EmpRoom WHERE RoomID NOT IN (...)) then selects the names of employees whose RoomID is not in the list obtained from the subquery.

  3. From the EmpRoom table, we can see that the employees who do not have RoomID 110 or 111 are Saito, Fukuda, and Oohira.

So, the final output of the SQL statement is "Saito, Fukuda, Oohira".

This problem has been solved

Similar Questions

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;

For the following tables: Student(studentId, studentName, address)            ('S01', 'Nguyen Van An', 'Hanoi'),            ('S02', 'Pham Tuan Anh', 'Hanoi'),            ('S03', 'Nguyen Minh Quan', 'Danang')Result(studentId, subjectId, score)            ('S01', 'J01', 8),            ('S01', 'S01', 7),            ('S02', 'J01', 3)Subject(subjectId, subjectName)            ('S01', 'SQL Basics'),            ('J01', 'Programming Java'),            ('N01', 'Programming C#')and a query:  SELECT s.studentName, r.subjectId, r.scoreFROM asql.Student s JOIN asql.Result r ON s.studentId =r.studentIdWhat is the result of the query?Nguyen Van An J01 8Nguyen Van An S01 7Pham Tuan Anh J01 3Nguyen Van An J01 8Nguyen Van An S01 7Pham Tuan Anh J01 3Nguyen Minh Quan NULL NULLNguyen Van An Programming Java 8Nguyen Van An SQL Basics 7Pham Tuan Anh Programming Java 3Nguyen Van An J01 8Pham Tuan Anh J01 3Nguyen Minh Quan NULL NULL

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.

Evaluate the SQL statement:SELECT a.emp_name, a.sal, a.dept_id, b.maxsal FROM employees a, (SELECT dept_id, MAX(sal) maxsal FROM employees GROUP BY dept_id) b WHERE a.dept_id = b.dept_id AND a.sal < b.maxsal;A. The statement gives an error at line 1. B. The statement gives an error at line 6.C. The statement produces the employee name, salary, department ID, and maximum salary earned in the employee department for all departments that pay less salary than the maximum salary paid in the company.D. The statement produces the employee name, salary, department ID, and maximum salary earned in the employee department for all employees who earn less than the maximum salary in their department.

Consider the table Employee given below: EmpId EmpName Salary DeptId200 Alex 30000 100201 Tom 20000 101202 Dick 40000 100202 Harry 15000 102205 Mary 50000 101206 Karl 40000 101SELECT EmpName FROM Employee WHERE Salary > ALL (SELECT Salary FROM Employee WHERE DeptId = 100);What will be the outcome of the query given above?

1/3

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.