ETL SQL Training Wk2 Where
ETL SQL Training Wk2 Where
, pg.CREATION_DATE
FROM PRODUCT_GROUPS pg
WHERE pg.CREATION_DATE IS NOT NULL
; PRODUCT_GROUP DESCRIPTION CREATION_DATE
416 Deal_Sourcer 31-Mar-11
417 Amazon_Sourced 31-Mar-11
424 Digital_Text_2 15-Jul-11
425 Digital_Accessories_2 15-Jul-11
414 A_Drive 20-Oct-10
251 Gourmet 4-Aug-03
241 Watches 4-Jun-03
236 Misc SDP 20-Dec-02
234 Travel Store 9-Sep-02
259 Sports Memorabilia 31-Oct-03
SELECT Another handy operator is
LIKE. It allows you to
pg.PRODUCT_GROUP search for a value in a
column that contains a
, pg.DESCRIPTION certain text string.
, pg.SHORT_DESC
FROM PRODUCT_GROUPS pg
WHERE pg.SHORT_DESC LIKE '%To%'
; It’s combined with a wildcard that takes the place of the rest of
the string.
For example, here we’re using the
SELECT LIKE operator to look for any value in
the SHORT_DESC column that has
pg.PRODUCT_GROUP the letters ‘To’ in it. We use the %
wildcard to take the place of any
, pg.DESCRIPTION characters on either side of the To.
, pg.SHORT_DESC
FROM PRODUCT_GROUPS pg
WHERE pg.SHORT_DESC LIKE '%To%'
;
For example, here we’re using the
SELECT LIKE operator to look for any value in
the SHORT_DESC column that has
pg.PRODUCT_GROUP the letters ‘To’ in it. We use the %
wildcard to take the place of 0-many
, pg.DESCRIPTION characters on either side of the To.
, pg.SHORT_DESC
FROM PRODUCT_GROUPS pg
WHERE pg.SHORT_DESC LIKE '%To%'
; It all gets put in single
quotes, because it’s a
text string.
For example, here we’re using the
SELECT LIKE operator to look for any value in
the SHORT_DESC column that has
pg.PRODUCT_GROUP the letters ‘To’ in it. We use the %
wildcard to take the place of 0-many
, pg.DESCRIPTION characters on either side of the To.
, pg.SHORT_DESC
FROM PRODUCT_GROUPS pg
WHERE pg.SHORT_DESC LIKE '%To%'
; It all gets put in single
quotes, because it’s a
text string.
FROM PRODUCT_GROUPS pg
WHERE UPPER(pg.SHORT_DESC) IS NULL
;