The SQL Workshop by Frank Solomon

The SQL Workshop by Frank Solomon

Author:Frank Solomon
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2020-12-29T00:00:00+00:00


Build a list of all the OrderID values in the Orders table, as follows:USE packt_online_shop;

SELECT O.OrderID

FROM Orders O;

Add a WHERE clause to the query. Use NOT IN to filter the Orders table with the subquery that we built first. Sort the result set by OrderID:USE packt_online_shop;

SELECT O.OrderID

FROM Orders O

WHERE O.OrderID NOT IN (SELECT OrderID FROM ORDERITEMS)

ORDER BY O.OrderID;

The output is as follows:

Figure 7.3: Printing the ID that's not common for the order in the OrderItems table

In this exercise, we filtered out the order ID for the order that does not have a corresponding entry in the OrderItems table.



Download



Copyright Disclaimer:
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.
Popular ebooks
Developing Robust Date and Time Oriented Applications in Oracle Cloud by Michal Kvet(3047)
Serverless ETL and Analytics with AWS Glue by Vishal Pathak Subramanya Vajiraya Noritaka Sekiyama Tomohiro Tanaka Albert Quiroga Ishan Gaur(2693)
Practical Guide to Azure Cognitive Services by Chris Seferlis & Christopher Nellis & Andy Roberts(2138)
Unity Artificial Intelligence Programming - Fifth Edition by Dr. Davide Aversa(1819)
Open Source Projects - Beyond Code by John Mertic(1744)
The AI Product Manager's Handbook by Irene Bratsis(1744)
Graph Data Modeling in Python by Gary Hutson and Matt Jackson(1717)
Cloud Auditing Best Practices by Shinesa Cambric & Michael Ratemo(1347)
Aligning Security Operations with the MITRE ATT&CK Framework by Rebecca Blair(1331)
Graph Data Processing with Cypher by Ravindranatha Anthapu(1118)
Data Literacy in Practice by Angelika Klidas Kevin Hanegan(1106)
Applied Machine Learning and High-Performance Computing on AWS by Mani Khanuja | Farooq Sabir | Shreyas Subramanian | Trenton Potgieter(1104)
Fuzzing Against the Machine: Automate vulnerability research with emulated IoT devices on QEMU by Antonio Nappa Eduardo Blazquez(950)
Implementing Multifactor Authentication: Protect your applications from cyberattacks with the help of MFA by Marco Fanti(946)
The AI Product Manager's Handbook: Develop a product that takes advantage of machine learning to solve AI problems by Irene Bratsis(834)
Data Literacy in Practice - A complete guide to data literacy and making smarter decisions with data through intelligent actions (2022) by Packt(828)
The SQL Workshop by Frank Solomon(813)
Graph Data Processing with Cypher by Anthapu Ravindranatha;(773)
Serverless Machine Learning with Amazon Redshift ML: Create, train, and deploy machine learning models using familiar SQL commands by Debu Panda Phil Bates Bhanu Pittampally Sumeet Joshi(723)
Network Automation with Go by Nicolas Leiva & Michael Kashin(609)