SQL: 2 books in 1: Advanced and Elite Level SQL From The Ground Up by Dvorjak Keith
Author:Dvorjak, Keith [Dvorjak, Keith]
Language: eng
Format: azw3, epub, pdf
Published: 2019-01-27T16:00:00+00:00
Correlated vs Non correlated Subqueries
Subqueries can be used in insert and select statements. Subqueries should return a scalar value if it makes use of WHERE clause or a value from the column if it is using IN or NOT IN clause. With this we now come to difference between correlated and no correlated sub queries. A subquery which depends upon the outer query and cannot execute on its own where as in case of non-correlated Subqueries both inner and outer queries are independent of each other.
SELECT * FROM DEPT_DATA d WHERE ENGG_ID IN (SELECT ENGG_ID FROM ENGINEERI
NG_STUDENTS e WHERE e.ENGG_ID=d.ENGG_ID );
+ - - - - - - -+ - - - - - - - - - - - - - - -+ - - - - - - - - - - -+ - - - - - - - +
| Dept_ID | HOD | NO_OF_Prof | ENGG_ID |
+ - - - - - - -+ - - - - - - - - - - - - - - -+ - - - - - - - - - - -+ - - - - - - - +
| 100 | Miley Andrews | 7 | 1 |
| 101 | Alex Dawson | 6 | 2 |
| 103 | Anne Joseph | 5 | 4 |
| 104 | Sophia Williams | 8 | 5 |
| 105 | Olive Brown | 4 | 6 |
| 106 | Joshua Taylor | 6 | 7 |
| 107 | Ethan Thomas | 5 | 8 |
| 108 | Michael Anderson | 8 | 9 |
| 109 | Martin Jones | 5 | 10 |
+ - - - - - - -+ - - - - - - - - - - - - - - -+ - - - - - - - - - - -+ - - - - - - - +
rows in set (0.16 sec)
When the inner sub query references the outer main query, we call it correlated Subqueries. The inner subquery references the column name of the table that is in outer query.
In case of Non correlated subquery the inner subquery is independent of outer main query.
SELECT * FROM DEPT_DATA d WHERE ENGG_ID IN (SELECT ENGG_ID FROM ENGINEERI
NG_STUDENTS );
+ - - - - - - -+ - - - - - - - - - - - - - - + - - - - - - - - - - + - - - - - - - - +
| Dept_ID | HOD | NO_OF_Prof | ENGG_ID |
+ - - - - - - -+ - - - - - - - - - - - - - - + - - - - - - - - - - + - - - - - - - - +
| 100 | Miley Andrews | 7 | 1 |
| 101 | Alex Dawson | 6 | 2 |
| 103 | Anne Joseph | 5 | 4 |
| 104 | Sophia Williams | 8 | 5 |
|
Download
SQL: 2 books in 1: Advanced and Elite Level SQL From The Ground Up by Dvorjak Keith.epub
SQL: 2 books in 1: Advanced and Elite Level SQL From The Ground Up by Dvorjak Keith.pdf
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8309)
Azure Data and AI Architect Handbook by Olivier Mertens & Breght Van Baelen(6792)
Building Statistical Models in Python by Huy Hoang Nguyen & Paul N Adams & Stuart J Miller(6768)
Serverless Machine Learning with Amazon Redshift ML by Debu Panda & Phil Bates & Bhanu Pittampally & Sumeet Joshi(6655)
Data Wrangling on AWS by Navnit Shukla | Sankar M | Sam Palani(6439)
Driving Data Quality with Data Contracts by Andrew Jones(6380)
Machine Learning Model Serving Patterns and Best Practices by Md Johirul Islam(6140)
Learning SQL by Alan Beaulieu(6004)
Weapons of Math Destruction by Cathy O'Neil(5795)
Big Data Analysis with Python by Ivan Marin(5389)
Data Engineering with dbt by Roberto Zagni(4395)
Solidity Programming Essentials by Ritesh Modi(4044)
Time Series Analysis with Python Cookbook by Tarek A. Atwan(3901)
Pandas Cookbook by Theodore Petrou(3603)
Blockchain Basics by Daniel Drescher(3305)
Hands-On Machine Learning for Algorithmic Trading by Stefan Jansen(2914)
Feature Store for Machine Learning by Jayanth Kumar M J(2819)
Learn T-SQL Querying by Pam Lahoud & Pedro Lopes(2803)
Mastering Python for Finance by Unknown(2748)
