What SQL query can be used to find the VendorIDs that appear in both the top 20
Fantastic news! We've Found the answer you've been seeking!
Question:
- What SQL query can be used to find the VendorIDs that appear in both the top 20 and bottom 20 invoices, based on their total invoice amounts? (using CTEs and the INTERSECT join condition)
Transcribed Image Text:
Connect C + dbo.InvoiceArchive dbo.InvoiceLineltems + dbo.Invoices dbo.Terms dbo.Vendors Columns VendorID (PK, int, not null) VendorName (varchar(50), not null) VendorAddress 1 (varchar(50), null) VendorAddress2 (varchar(50), null) E VendorCity (varchar(50), not null) VendorState (char(2), not null) VendorZipCode (varchar(20), not null) VendorPhone (varchar(50), null) VendorContactLName (varchar(50), null) VendorContactFName (varchar(50), null) DefaultTermsID (FK, int, not null) DefaultAccountNo (FK, int, not null) Keys TO PK_Vendors FK Vendors GLAccounts OFK Vendors Terms Constraints DF_Vendors_AccountNo DF_Vendors TermsID Triggers Indexes IX VendorName (Non-Unique, Non-Clustered) IX_Vendors_Account No (Non-Unique, Non-Clustered) IX_Vendors_TermsID (Non-Unique, Non-Clustered) TOPK_Vendors (Clustered) Statistics _WA_Sys_00000008_3F466844 IX_VendorName MIX Vendors_AccountNo IX Vendors_TermsID HPK_Vendors Views External Resources Synonyms Connect C + dbo.InvoiceArchive dbo.InvoiceLineltems + dbo.Invoices dbo.Terms dbo.Vendors Columns VendorID (PK, int, not null) VendorName (varchar(50), not null) VendorAddress 1 (varchar(50), null) VendorAddress2 (varchar(50), null) VendorCity (varchar(50), not null) VendorState (char(2), not null) VendorZipCode (varchar(20), not null) VendorPhone (varchar(50), null) VendorContactLName (varchar(50), null) VendorContactFName (varchar(50), null) DefaultTermsID (FK, int, not null) DefaultAccountNo (FK, int, not null) Keys TO PK_Vendors FK Vendors_GLAccounts OFK Vendors_Terms Constraints DF_Vendors_AccountNo DF_Vendors TermsID Triggers Indexes IX_VendorName (Non-Unique, Non-Clustered) IX_Vendors_Account No (Non-Unique, Non-Clustered) IX_Vendors_TermsID (Non-Unique, Non-Clustered) TOPK_Vendors (Clustered) Statistics _WA_Sys_00000008_3F466844 IX_VendorName MIX Vendors_AccountNo IX Vendors_TermsID HPK_Vendors Views External Resources Synonyms Connect C + dbo.InvoiceArchive dbo.InvoiceLineltems + dbo.Invoices dbo.Terms dbo.Vendors Columns VendorID (PK, int, not null) VendorName (varchar(50), not null) VendorAddress 1 (varchar(50), null) VendorAddress2 (varchar(50), null) E VendorCity (varchar(50), not null) VendorState (char(2), not null) VendorZipCode (varchar(20), not null) VendorPhone (varchar(50), null) VendorContactLName (varchar(50), null) VendorContactFName (varchar(50), null) DefaultTermsID (FK, int, not null) DefaultAccountNo (FK, int, not null) Keys TO PK_Vendors FK Vendors GLAccounts OFK Vendors Terms Constraints DF_Vendors_AccountNo DF_Vendors TermsID Triggers Indexes IX VendorName (Non-Unique, Non-Clustered) IX_Vendors_Account No (Non-Unique, Non-Clustered) IX_Vendors_TermsID (Non-Unique, Non-Clustered) TOPK_Vendors (Clustered) Statistics _WA_Sys_00000008_3F466844 IX_VendorName MIX Vendors_AccountNo IX Vendors_TermsID HPK_Vendors Views External Resources Synonyms Connect C + dbo.InvoiceArchive dbo.InvoiceLineltems + dbo.Invoices dbo.Terms dbo.Vendors Columns VendorID (PK, int, not null) VendorName (varchar(50), not null) VendorAddress 1 (varchar(50), null) VendorAddress2 (varchar(50), null) VendorCity (varchar(50), not null) VendorState (char(2), not null) VendorZipCode (varchar(20), not null) VendorPhone (varchar(50), null) VendorContactLName (varchar(50), null) VendorContactFName (varchar(50), null) DefaultTermsID (FK, int, not null) DefaultAccountNo (FK, int, not null) Keys TO PK_Vendors FK Vendors_GLAccounts OFK Vendors_Terms Constraints DF_Vendors_AccountNo DF_Vendors TermsID Triggers Indexes IX_VendorName (Non-Unique, Non-Clustered) IX_Vendors_Account No (Non-Unique, Non-Clustered) IX_Vendors_TermsID (Non-Unique, Non-Clustered) TOPK_Vendors (Clustered) Statistics _WA_Sys_00000008_3F466844 IX_VendorName MIX Vendors_AccountNo IX Vendors_TermsID HPK_Vendors Views External Resources Synonyms
Expert Answer:
Answer rating: 100% (QA)
Based on the information provided in the screenshots for the database structure you can write a SQL ... View the full answer
Related Book For
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall
Posted Date:
Students also viewed these databases questions
-
Solve the following equations in the interval [0,2): a) tan + 3=0 b) sin(30) = 1 c) 8 12sin20 = 4cos20 d) sin cos 0 = 1 e) csc0 = 1
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
On your computer, go to this tutorial to study the basic MongoDB CRUD operations: https://docs.mongodb.com/manual/crud/ Open our lab MongoDB collection at: https://mongoplayground.net/p/xxyyMDsySoJ...
-
1. A projectile is launched in a vertical plane, at an angle 0 with initial velocity vo. It must be caught in a frictionless circular tube of radius R in such a way that the trajectory of the...
-
The constant -volume heat capacity of a gas can be measured by observing the decrease in temperature when it expands adiabatically and reversibly. If the decrease in pressure is also measured, we can...
-
Define (a) Digestion. (b) Reprecipitation. (c) Counter-ion layer. (d) Supersaturation.
-
What is the added worker effect? What is the discouraged worker effect?
-
The budget director of Birding Homes & Feeders Inc., with the assistance of the controller, treasurer, production manager, and sales manager, has gathered the following data for use in developing the...
-
A positively charged particle Q 1 = + 4 5 nC is held at fixed position. A second charge Q 2 of mass m = 3 . 5 mu g is located a distance d = 3 5 cm directly above charge Q 1 . The net force on Q 2 is...
-
Hot & Cold and CaldoFreddo are two European manufacturers of home appliances that have merged. Hot & Cold has plants in France, Germany, and Finland, whereas CaldoFreddo has plants in the...
-
Explain the importance of ethical expectations and modeling ethical practices in le within education. your future
-
Describe the structural and functional implications of the anatomical variations in the human vertebral column.
-
A new product line for BMW could be a line of electric vehicles. Research and answer the following questions for your marketing plan. Questions: Who are your competitors? What features distinguish...
-
Critically evaluate the anatomical variations and clinical implications of the venous drainage patterns in the lower extremities, particularly in the context of venous insufficiency and deep vein...
-
What molecular mechanisms govern the formation and resolution of chromosomal crossovers during meiosis, and how do they contribute to genetic recombination and the generation of novel allelic...
-
Explain the role of telomeres and telomerase in maintaining chromosomal stability and preventing cellular senescence, and how dysregulation of these mechanisms contributes to aging and cancer?
-
Based on the table below set up a schedule/table in Excel and solve the missing component. Use a financial formula in Excel to solve. Make sure to LINK all the information. 1 Description Face Value...
-
Prove that the mean heat capacities C P H and C P S are inherently positive, whether T > T 0 or T < T 0 . Explain why they are well defined for T = T 0 .
-
In what four categories does the FOLKLORE documentation method collect information?
-
As one of the systems analysts who is part of Sylva Foxxs firm, suggest some ways that Sam Pelt can use software on the PC he has to adequately sample the opinions of his customers, store managers,...
-
Whose primary responsibility is it to test computer programs?
-
In Figure 31. 28, which of the three bulbs \(F, G\), and \(H\) light up? Data from Figure 31. 28 (e) H
-
In Figure 31. 27, bulb E is brighter than bulb D. Which bulb has \((a)\) the greater potential difference across it, \((b)\) more current in it, and \((c)\) more resistance? Data from Figure 31. 27 D...
-
A thick resistor and a thin resistor of the same length and material are connected in series, as shown in Figure 31. 29. Which resistor has \((a)\) the greater potential difference across it and...
Study smarter with the SolutionInn App