Question
Good Evening, I'm looking for some assistance with this SQL Server/DBA exercise: I need to write two different queries to list Vendor records with AccountDescription
Good Evening, I'm looking for some assistance with this SQL Server/DBA exercise:
I need to write two different queries to list Vendor records with AccountDescription = 'Outside Services'. The first query should use a JOIN (Vendors and GLAccounts) and the second query should use a subquery. I have to analyze the Execution plan for both queries and make a recommendation on which query should be used and why. I also need a screen-print of the query and execution plan. I do have the script if necessary
Please note I cannot copy the script for it is too big to paste on here if there's another alternative please let me know.
USE [master] GO 0bject: Database [AP_Allobjects Script Date: 11/5/2018 5:31:16 AM/ CREATE DATABASE [AP Allobjects] CONTAINMENT = NONE ON PRIMARY ( NAME -N'AP_A110bjects', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLTEST\MSSQL\DATA\AP_A110bjects.mdf' , SIZE = 8192KB , MAXSIZE UNLIMITED, FILEGROWTH 65536KB ) LOG ON ( NAME N'AP_A11Objects-log", FILENAME N"C:\Program Files\Microsoft SQL Server\MSSQL14.SQLTESTVMSSQLNDATA\AP_ALL0biects..Les.1at. , szE 8192KB , MAXSIZE GO ALTER DATABASE [AP-ALLObjects] SET COMPATIBILITY-LEVEL 110 GO IF (1 FULLTEXTSERVISEPROPERTY( IsFulLTextInstalled')) begin EXEC [AP Allobjectsl.[dbo]. [sp fulltext_databasel eactionenable end GO ALTER DATABASE [AP_All0bjects] SET ANSI NULL_DEFAULT OFF GO ALTER DATABASE [AP_Allobjects] SET ANSI NULLS OFF GO ALTER DATABASE [AP ALLobjects] SET ANSI_PADDING OFF GO ALTER DATABASE [AP_A110bjects] SET ANSI-WARNINGS OFF GO ALTER DATABASE [AP_AllObjects] SET ARITHABORT, OFF GO ALTER DATABASE [AP_AlLObjects] SET AUTO CLOSE ON GO ALTER DATABASE [AP_AlLObjects] SET AUTO_SHRINK ON GO ALTER DATABASE [AP ALlobjects] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [AP ALlobjects] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [AP_ALlobjectsl SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [AP_ALlobjects] SET CONCAT NULL_YIELDS NULL OFF GO ALTER DATABASE [AP_ALlobjects] SET NUMERIC ROUNDABORT. OFF GO ALTER DATABASE [AP_All0bjects] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [AP_All0bjects] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [AP_Allobjects] SET DISABLE_BROKER GO ALTER DATABASE [AP_Allobjects] SET AUTO UPDATE STATISTICS_ASYNC OFF GO ALTER DATABASE [AP_Allobjects] SET DATE_CORRELATION 0PTIMIZATION OFF GO ALTER DATABASE [AP_Allobjects] SET TRUSTWORTHY OFF GO ALTER DATABASE [AP Allobjects] SET ALLOW SNAPSHOT ISOLATION OFF GO ALTER DATABASE [AP_Allobjects] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [AP Allobjects] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [AP_Allobjects] SET HONOR_ BROKER PRIORITY OFF GO ALTER DATABASE [AP_Allobjects] SET RECOVERY SIMPLE GO ALTER DATABASE [AP ALLobjects] SET MULTI_USER GO ALTER DATABASE [AP_ALLObjects] SET PAGE_VERIFY NONE GO ALTER DATABASE [AP_AllObjects] SET DB_CHAINING OFF GO ALTER DATABASE [AP_AlLObjects] SET FILESTREAM NON_TRANSACTED ACCESS-OFF GO ALTER DATABASE [AP-ALIObjects] SET TARGET-RECOVERY TIME = 0 SECONDS GO ALTER DATABASE [AP ALlobjects] SET DELAYED_DURABILITYDISABLED GO ALTER DATABASE [AP ALLobjects] SET QUERY_STORE-OFF GO USE [AP_Allobjects] GO ALTER DATABASE SCOPED CONFIGURATION SET IDENTITY CACHE ON 2048GB , FILEGROWTH 65536KB ) USE [master] GO 0bject: Database [AP_Allobjects Script Date: 11/5/2018 5:31:16 AM/ CREATE DATABASE [AP Allobjects] CONTAINMENT = NONE ON PRIMARY ( NAME -N'AP_A110bjects', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL14.SQLTEST\MSSQL\DATA\AP_A110bjects.mdf' , SIZE = 8192KB , MAXSIZE UNLIMITED, FILEGROWTH 65536KB ) LOG ON ( NAME N'AP_A11Objects-log", FILENAME N"C:\Program Files\Microsoft SQL Server\MSSQL14.SQLTESTVMSSQLNDATA\AP_ALL0biects..Les.1at. , szE 8192KB , MAXSIZE GO ALTER DATABASE [AP-ALLObjects] SET COMPATIBILITY-LEVEL 110 GO IF (1 FULLTEXTSERVISEPROPERTY( IsFulLTextInstalled')) begin EXEC [AP Allobjectsl.[dbo]. [sp fulltext_databasel eactionenable end GO ALTER DATABASE [AP_All0bjects] SET ANSI NULL_DEFAULT OFF GO ALTER DATABASE [AP_Allobjects] SET ANSI NULLS OFF GO ALTER DATABASE [AP ALLobjects] SET ANSI_PADDING OFF GO ALTER DATABASE [AP_A110bjects] SET ANSI-WARNINGS OFF GO ALTER DATABASE [AP_AllObjects] SET ARITHABORT, OFF GO ALTER DATABASE [AP_AlLObjects] SET AUTO CLOSE ON GO ALTER DATABASE [AP_AlLObjects] SET AUTO_SHRINK ON GO ALTER DATABASE [AP ALlobjects] SET AUTO_UPDATE_STATISTICS ON GO ALTER DATABASE [AP ALlobjects] SET CURSOR_CLOSE_ON_COMMIT OFF GO ALTER DATABASE [AP_ALlobjectsl SET CURSOR_DEFAULT GLOBAL GO ALTER DATABASE [AP_ALlobjects] SET CONCAT NULL_YIELDS NULL OFF GO ALTER DATABASE [AP_ALlobjects] SET NUMERIC ROUNDABORT. OFF GO ALTER DATABASE [AP_All0bjects] SET QUOTED_IDENTIFIER OFF GO ALTER DATABASE [AP_All0bjects] SET RECURSIVE_TRIGGERS OFF GO ALTER DATABASE [AP_Allobjects] SET DISABLE_BROKER GO ALTER DATABASE [AP_Allobjects] SET AUTO UPDATE STATISTICS_ASYNC OFF GO ALTER DATABASE [AP_Allobjects] SET DATE_CORRELATION 0PTIMIZATION OFF GO ALTER DATABASE [AP_Allobjects] SET TRUSTWORTHY OFF GO ALTER DATABASE [AP Allobjects] SET ALLOW SNAPSHOT ISOLATION OFF GO ALTER DATABASE [AP_Allobjects] SET PARAMETERIZATION SIMPLE GO ALTER DATABASE [AP Allobjects] SET READ_COMMITTED_SNAPSHOT OFF GO ALTER DATABASE [AP_Allobjects] SET HONOR_ BROKER PRIORITY OFF GO ALTER DATABASE [AP_Allobjects] SET RECOVERY SIMPLE GO ALTER DATABASE [AP ALLobjects] SET MULTI_USER GO ALTER DATABASE [AP_ALLObjects] SET PAGE_VERIFY NONE GO ALTER DATABASE [AP_AllObjects] SET DB_CHAINING OFF GO ALTER DATABASE [AP_AlLObjects] SET FILESTREAM NON_TRANSACTED ACCESS-OFF GO ALTER DATABASE [AP-ALIObjects] SET TARGET-RECOVERY TIME = 0 SECONDS GO ALTER DATABASE [AP ALlobjects] SET DELAYED_DURABILITYDISABLED GO ALTER DATABASE [AP ALLobjects] SET QUERY_STORE-OFF GO USE [AP_Allobjects] GO ALTER DATABASE SCOPED CONFIGURATION SET IDENTITY CACHE ON 2048GB , FILEGROWTH 65536KB )
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started