Selecting one or more columns from a table, Selecting one or more data rows from a table – Wavetronix Command Translator (CMD-DT) - User Guide User Manual
Page 152

APPENDIX 151
TableOne and TableTwo, each contain four columns (the data types of these columns are
usually not necessary to know):
˽
TableOne – One, Two, Three, Four
˽
TableTwo – Five, Six, Seven, Eight
A basic SELECT query, which will grab all data rows and columns from TableOne, will look
like this:
SELECT * from TableOne
The “*” character represents a desire to have all columns and all rows from TableOne. This
basic query is usually unnecessary because TaskBuilder operations default to a “select all”
without needing to write a specific SQL statement. If you want all information in TableOne,
the regular TaskBuilder behavior can be used without writing SQL.
Selecting One or More Columns From a Table
If you desire columns One and Four from TableOne, but not Two and Three, then replace
the “*” with the specific column names separated by commas:
SELECT One, Four from TableOne
You can specify an unlimited number of columns in a SELECT statement. If desired, you
can also select columns more than once:
SELECT Two, Three, Four, Two from TableOne
The resulting data set will have four columns with data from column Two being in both the
first and last columns. This is redundant, but the option is available.
Selecting One or More Data Rows From a Table
Another common operation is selecting only certain rows that meet certain criteria from
the data table. To add a qualifier to the query, use a WHERE clause; strings must be en-
closed in single quotation marks:
SELECT * from TableOne WHERE One > 100
SELECT * from TableTwo WHERE Six = ‘Hello’
The data types of each column will need to be known for WHERE statements to be created.
An error will occur in column six if the WHERE Six = ‘Hello’ statement contains integers.
The query will return an empty set if the data row does not meet the criteria.
Multiple WHERE clauses can be used by conjoining them with either the AND or OR
keywords: