First page Back Continue Last page Image

Using CREATE OR REPLACE on a View

Let’s say you use a common format to do your views so you can keep track of them but you do not remember if you have already done this particular table yet, you want to say Create it if it does not exist and Replace it if it does

CREATE OR REPLACE VIEW vendor_invoices AS

SELECT vendor_name, invoice_number,

invoice_date,invoice_total

FROM vendors JOIN invoices

ON vendors.vendor_id = invoices.vendor_id

All the code in gray is just a regular query like we did in week 4