Type up the scripts for the following questions as a script file or a document and upload it to ANGEL Write a CREATE VIEW statement that defines a view named InvoiceBasic that returns three columns VendorName. InvoiceNumber, and InvoiceTotal Then, write a SELECT statement that returns all of the columns in the view, sorted by VendorName, w here the first letter of the vendor name is N, O, or P. Create a view named Top10Paidlnvoices that returns three columns for each vendor VendorName. Lastlnvoicc (the most recent invoice date), and SumOfinvoices (the sum of the InvoiceTotal column) Return only the 10 vendors with the largest SumOfinvoices and include only paid invoices Create an updatable view named Vendor Address that returns the VendorlD. both address columns, and the city, state, and zip code columns for each vendor Then, write a SELECT query to examine the result set where VcndorID=4. Next, write an UPDATE statement that changes the address so that the suite number (Ste 260) is stored in Vendor Address2 rather than in Vendor Address I.(Make sure to rerun your SELECT query in order to verity the change) Create a view named AccountBy Vendor that returns the sum of InvoiceLineliemAmounts in the InvoiceLineltems table, grouped by VendorName and AccountDescription. Modify the InvoiceBasic view created in exercise I to sort the result set by VendorName
1).
create view InvoiceBasic as
select VendorName,InvoiceNumber,InvoiceTotal from Invoice;
select statement:
select *from InvoiceBasic where VendorName like \'N%\' or VendorName like \'O%\' or VendorName like \'P%\';
2).
create or replace view Top10PaidInvoices as
select VendorName,LastInvoice,sum(PaidInvoice) as InvoiceTotal from Invoice;
select statement:
select top10 *from Top10PaidInvoices
3).
create or replace view VendorAddress as
select VendorId,Address1,Address2,city,state,zip from Vendor
select statement:
select *from VendorAddress where VendorId=4;
update VendorAddress set address2=suite260;
4).
create or replace view AccountByVendor as
select sum(InvoiceLineItemAmounts) from InvoiceLineItems group by VendorName
5).create view InvoiceBasic as
select VendorName,InvoiceNumber,InvoiceTotal from Invoice;
select statement:
select *from InvoiceBasic order by VendorName