Table of Contents

Search

  1. Preface
  2. Introduction to Test Data Management
  3. Test Data Manager
  4. Projects
  5. Policies
  6. Data Discovery
  7. Data Subset
  8. Data Masking
  9. Data Masking Techniques and Parameters
  10. Data Generation
  11. Data Generation Techniques and Parameters
  12. Working with Test Data Warehouse
  13. Analyzing Test Data with Data Coverage
  14. Plans and Workflows
  15. Monitor
  16. Reports
  17. ilmcmd
  18. tdwcmd
  19. tdwquery
  20. Data Type Reference
  21. Data Type Reference for Test Data Warehouse
  22. Data Type Reference for Hadoop
  23. Glossary

Where Clause

Where Clause

You can use the Where clause to specify filter criteria in a query with the Select and Select Distinct clauses.
You can run queries that use parentheses with the Where clause. For example:
SELECT * from Employee where NAME ='Mary' OR (NAME='Jessica' AND DEPT_ID=1)
You can use the Where clause with the following conditions in a query:
Single condition
Use the following syntax:
SELECT * FROM <table_name> WHERE <column_name> = <column_value>
For example:
SELECT * FROM customers WHERE state = 'California'
And
Use the following syntax:
SELECT * FROM <table_name> WHERE <column_name> = <column_value> AND <column_value> <operator> <column_value>
For example:
SELECT * FROM customers WHERE state = 'California' AND company_name = 'Informatica'
OR
Use the following syntax:
SELECT * FROM <table_name> WHERE <column_name> = <column_value> OR <column_name> <operator> <column_value>
For example:
SELECT * FROM customers WHERE state = 'California' OR company_name = 'Informatica'
Combining OR and AND
Use the following syntax:
SELECT * FROM <table_name> WHERE <column_name> = <column_value> OR <column_name> <operator> <column_value> AND <column_name> <operator> <column_value>
For example:
SELECT * FROM customers WHERE state = 'California' OR available_credit > 500 and revenue < 90
Joining and where
Use the following syntax:
SELECT columns FROM <table 1> LEFT OUTER JOIN <table 2> ON <table 1>.<col 1> = <table 2>.<col 1> WHERE <table 1>.<col 1> <operator> <column_value>
For example:
SELECT suppliers.supplier_id, suppliers.supplier_name, orders.order_date FROM suppliers LEFT OUTER JOIN orders ON suppliers.supplier_id = orders.supplier_id WHERE supplier.supplier_id > 10
Exists
Use the following syntax:
SELECT DISTINCT <col 1> FROM <table 2> WHERE EXISTS (SELECT * FROM <table 2> WHERE <table 1>.<col 1> <operator> <table 1>.<col 1>)
For example:
SELECT DISTINCT store_type FROM stores WHERE EXISTS (SELECT * FROM cities_stores WHERE cities_stores.store_type = stores.store_type)
In
Use the following syntax:
SELECT * FROM <table 1> WHERE <col 1> IN (SELECT <col 1> FROM <table 2>)
For example:
SELECT * FROM Employee WHERE dept_id IN (SELECT DEPT_ID FROM TDWDEPT)
Like
Use the following syntax:
SELECT * FROM <table 1> WHERE <col 1> LIKE <value>
You can use characters or wildcards '%' and '_'. For example:
SELECT * FROM Employee WHERE name LIKE 'J%'
Is Null or Is Not Null
Use the following syntax:
SELECT * FROM <table 1> WHERE <col 1> IS NULL
For example:
SELECT * FROM Employee WHERE ssn IS NULL
Between
Use the following syntax:
SELECT * FROM <table 1> WHERE <col 1> BETWEEN <value> AND <value>
For example:
SELECT * FROM Employee WHERE delt_id BETWEEN 2 AND 3
Not
Use the following syntax:
SELECT * FROM <table 1> WHERE <col 1> NOT <CONDITION> <value>
For example:
SELECT DISTINCT * from STATE s WHERE NOT EXISTS (SELECT ct.state_id from city ct where ct.state_id = s.state_id)
SELECT * FROM Employee WHERE dept_id NOT IN (SELECT DEPT_ID FROM TDWDEPT)
SELECT * FROM Employee WHERE name NOT LIKE 'J%'
SELECT * FROM Employee WHERE delt_id NOT BETWEEN 2 AND 3