Question
  1. Write a select statement that returns the vendorname and paymentsum of each vendor, where paymentsum is the sum of the paymentotal column. Return only the top ten vendors who have been paid the most and the number of invoices is >5.

CREATE TABLE InvoiceArchive InvoiceID int NOT NULL, VendorID int NOT NULL InvoiceNumber varchar(50) NOT NULL, InvoiceDate sma/****** Object: Table Terms ******/ E CREATE TABLE Terms TermsID int IDENTITY(1,1) NOT NULL, TermsDescription varchar(50) NOT

0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts/errors, please give me comment...

SELECT TOP 10 VendorName, SUM(PaymentTotal) AS Payments

FROM Vendors V, Invoices I

WHERE V.VendorID = I.VendorID

GROUP BY V.VendorID, VendorName

HAVING COUNT(*)>5;

Add a comment
Know the answer?
Add Answer to:
Write a select statement that returns the vendorname and paymentsum of each vendor, where paymentsum is...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make t...

    Someone Please Help Me modify this in PHP I'm in desperate need I cant figure this out ... Make the following modifications: For the vendors table: Comment out the table-level primary key Change the VendorIDcolumn to be a column-level primary key Add a VendorEmail column to the bottom of the table definition (define the data type for the column as variable character and set it to not exceed 45 characters) After the lineItems table, add code to create a table...

  • SQL SERVER Write a SELECT statement that return the vendor name and the total number of...

    SQL SERVER Write a SELECT statement that return the vendor name and the total number of accounts that apply to that vendor’s invoices. Filter the result set to include only the vendor who is being paid more than twice. (HINT: use Vendors table, Invoices table and InvoiceLineItems table). TABLES: Vendor Columns: VendorID, VendorName, DefaultTermsID, DefaultAccountNo Invoices Columns: InvoiceID, VendorID, InvoiceNumber, InvoiceDate, InvoiceTotal, PaymentTotal, CreditTotal, TermsID InvoiceLineItems Columns: InvoiceID, InvoiceSequence, AccountNo, InvoiceLineItemAmount, InvoiceLineItemDescription

  • SQL - write a select statement that returns four columns: vendorName, invoiceNumber, invoiceDate, and invoiceTotal. Return...

    SQL - write a select statement that returns four columns: vendorName, invoiceNumber, invoiceDate, and invoiceTotal. Return ONE ROW per vendor, representing the vendors invoice with the earliest date.

  • Give the SQL statement that will find the vendor that provides that most products. Output the...

    Give the SQL statement that will find the vendor that provides that most products. Output the Vendor Name and the count of products. categories CategorylD INT(11) ◇ CategoryDescription VARCHAR( 75) Custom erID INT(11) CustFirstName VARCHAR(25) ◇CustLastName VARCHAR(25) ◇ CusstreetAddress VARCHAR(50) ◇ CustCity VARCHAR(30) ◇ Cusstate VARCHAR(2) order_details OrderNumber INT(11) ProductNum ber INT (11) QuotedPrice DECIMAL(15,2) QuantityOrdered SMALLINT(6) OrderNumber INT(11) ◇ OrderDate DATE ShipDate DATEK CustomerID INT(11) EmployeeID INT(11) CustzipCode VARCHAR( 10) custrea Code SMALLINT(6) ◇ CustphoneN umber VARCHAR(8) ProductNum ber...

  • -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),    ...

    -- Schema definition create table Customer (     cid   smallint not null,     name varchar(20),     city varchar(15),     constraint customer_pk         primary key (cid) ); create table Club (     club varchar(15) not null,     desc varchar(50),     constraint club_pk         primary key (club) ); create table Member (     club varchar(15) not null,     cid   smallint     not null,     constraint member_pk         primary key (club, cid),     constraint mem_fk_club         foreign key (club) references Club,     constraint mem_fk_cust...

  • Hello, Does anyone have any input on how to fragment this table in visual studio? CREATE...

    Hello, Does anyone have any input on how to fragment this table in visual studio? CREATE TABLE [dbo].[Stock] ( [itemNo] INT NOT NULL , [store] VARCHAR(50) NOT NULL, [qtyOnHand] INT NULL, [qtyHand] INT NULL, [qtyOnOrder] INT NULL, [reorderPoint] INT NULL, CONSTRAINT [FK_Stock_Item] FOREIGN KEY ([itemNo]) REFERENCES [Item]([itemNo]), CONSTRAINT [FK_Stock_Store] FOREIGN KEY ([store]) REFERENCES [Store]([storeName]), CONSTRAINT [PK_Stock] PRIMARY KEY ([itemNo], [store]), The other tables are: CREATE TABLE [dbo].[Item] ( [itemNo] INT NOT NULL PRIMARY KEY, [itemName] VARCHAR(50) NULL, [supplier] VARCHAR(50) NULL,...

  • Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial...

    Create a stored procedure that allows a user to select a bat’s manufacturer and (optionally) serial number using a stored procedure. The output should display all of the players who use the bat’s manufacturer. If the serial number is also provided, only display the players who use that bat’s manufacturer and serial number. Make sure you use a CREATE PROCEDURE call and insert this procedure into the existing database. Submit a document that includes: 1. Commented code for the stored...

  • MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects...

    MICROSOFT SQL SERVER - Create the following views 1.List the employee assigned to the most projects 2.List the project with the most hours SCRIPT TO BUILD DATABASE create table department ( dept_ID int not null , dept_name char(50) NOT NULL, manager_ID int not null, manager_start_date date not null, constraint Dept_PK primary key (dept_ID), constraint D_Name_AK unique (dept_name) ); insert into department values(1,'abc',1,'2019-01-08'); insert into department values(2,'abc2',2,'2019-01-08'); insert into department values(3,'abc3',2,'2019-01-08'); insert into department values(4,'abc4',2,'2019-01-08'); /*project table done*/ create table project...

  • How do I add images to the last columns named Product_Image and Product_Thumbnail? Need code for...

    How do I add images to the last columns named Product_Image and Product_Thumbnail? Need code for stored procedure and code behind if needed. TABLE INFO CREATE TABLE [dbo].[ExampleTable] ( [Id] INT IDENTITY (1, 1) NOT NULL, [Product_ID] VCHAR (50) NOT NULL, [Product_Name] VCHAR (50) NOT NULL, [Product_Image] IMAGE NULL, [Product_Thumbnail] IMAGE NULL, PRIMARY KEY CLUSTERED ([Id] ASC) )

  • Using the table below, Write 2 simple/short TRIGGER STATEMENTS (WITH GOOD BUSINESS VALUE), After writing the...

    Using the table below, Write 2 simple/short TRIGGER STATEMENTS (WITH GOOD BUSINESS VALUE), After writing the trigger statements, please comment on what the TRIGGER IS DOING. CREATE TABLE STUDENT_TBL ( STU_ID       NUMBER (8) NULL, F_NAME       VARCHAR (20) NULL,   L_NAME       VARCHAR (30) NULL,   STU_MAJOR       VARCHAR (20) NULL,   STU_ADDR        VARCHAR (50) NULL, STU_EMAIL       VARCHAR (30) NULL, CONSTRAINT PKSTU primary key (STU_ID) ); DESCRIBE STUDENT_TBL; CREATE TABLE ENROLL_TBL ( ENR_ID   NUMBER (8), ENR_DATE     DATE (10)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT