February 2011 Entries

Before I create views, I generally work out what I want to retrieve
in my SELECT statement ahead of time so I'll just  have to cut and  paste the query. The example below is done  in T-SQL/Sybase format, however for Oracle and MySQL, just  place a semi-colon ';' at the end of your statement and remove the  'GO' command.
        

To drop (delete) an existing view:

DROP VIEW vw_rpt_metroBestCustomers
GO

To create a view:

CREATE VIEW vw_rpt_metroBestCustomers
( CustomerName,
   OfficeNum,
   City,
   StateOrProv,
   Country,
   ZipCode
  )
AS
SELECT a.FirstName + ', ' + a.LastName,
          b.OfficePhoneNum,
          c.City,
          c.StateOrProvAbbr,
          c.Country,
          c.PostalCode
    FROM Customer a,
         CustLocAssoc x,
         CustContactAssoc y,
         Location c,
         Contact b
    WHERE a.CustID = x.CustID
      AND a.CustID = y.CustID
      AND y.ContactID = b.ContactID
      AND x.LocID = c.LocID
      AND a.LoyaltyMedian > 85.5

GO
      

I frequently rename columns when developing views to make
it easier for simple, text-based reporting--however, renaming
the columns isn't necessary.

The create view statement above could have been written
as follows:


CREATE VIEW vw_rpt_metroBestCustomers
AS
(SELECT a.FirstName + ', ' + a.LastName,
b.OfficePhoneNum,
c.City,
c.StateOrProvAbbr,
c.Country,
c.PostalCode
FROM Customer a,
CustLocAssoc x,
CustContactAssoc y,
Location c,
Contact b
WHERE a.CustID = x.CustID
AND a.CustID = y.CustID
AND y.ContactID = b.ContactID
AND x.LocID = c.LocID
AND a.LoyaltyMedian > 85.5
)
GO

Here is the quick answer:

  •  Go into your client e software (e.g. Outlook, Thunderbird, etc.) for the account you are working on (usually default). Set the SMTP server to smtp.gmail.com
  • Set the username as your gmail account user name (e.g. myname@gmail.com). Gmail will need the username and password you use for that account, so if your default is set to some other email, be sure to set the username and password to that value, or click on the checkbox for username/password.
  • Check TLS as the secure connection.

 

If you are looking for more in-depth info, check out