Answer:
The query is constructed.
Explanation:
Queries help us to interact with the database for various operations of data retrieval, updating, deletion, and inserting. In this article let us see a query to get the information of an employee where the employee is not assigned to any department. When in a table if any attribute is not assigned with any value, it would be the NULL so let us execute the query on a table in the database company.
- A subquery is a SELECT statement that is embedded in a clause of another SELECT statement. You can build powerful statements out of simple ones by using subqueries. They can be very useful when you need to select rows from a table with a condition that depends on the data in the table itself.
You can place the subquery in a number of SQL clauses
• WHERE clause
• HAVING clause
• FROM clause
- ln the syntax;
- operator includes a comparison operator such as >, =, or IN
- Note: Comparison operators fall into two classes: single-row operators
- ( > , = , >= , < , < > , <= )
- and multiple-row operators ( IN , ANY , ALL ).
- Single-row subgueries: Queries that return only one row from the inner SELECT stntenıent
- Muliple-row subqueries: QUERIES that return more than one rows from the inner SELECT statement
- Muliple-column subqueries: QUERIES that return more than one column from the inner SELECT statement.
To find the employee id, name, department id , name of all employees who have a department assigned with the department location as chennai
- SELECT e.last_name, e.job_id, e.department_id,d.department_name
FROM employees e JOIN departments d
ON (e.department_id = d.department_id)
JOIN locations l
ON (d.location_id = l.location_id)
WHERE LOWER(l.city) = ’Chennai’;
FROM emp e, dept d
WHERE e.deptno = d.deptno
AND d.loc='Chennai';
Reference Link
- https://brainly.in/question/39223424