If you find that the examples in this tutorial do not work as shown, you may need to install or restore the example database with the "DatabaseLink`DatabaseExamples`" package, as described in "Using the Example Databases".
|select all data from the table
|select data in certain columns from the table
|select data in certain columns from the table meeting the condition
The third parameter of SQLSelect can be used to select only certain columns. In this example, only the TITLE_ID and ROYALTY columns are selected.
There are a number of options that can be given to SQLSelect.
|whether to return only distinct results
|JDBC driver hint for filling result sets
|whether to return the results as strings
|byte limit for variable-length column types
|set the maximum number of rows returned
|whether to return headings with the results
|how to sort the data
|symbols to be associated with results
|set the timeout for a query
Options of SQLSelect.
It is possible to select data from multiple columns in multiple tables. You can select multiple tables by giving a second argument that is a list of the table names. A list of column names should be used as the third parameter, as shown previously. You can also associate a specific table with a column by pairing a column name with a table name in a list in the third argument. This is important if the same column name is used in more than one table. The following example of a data join generates an outer product of the data in the two tables and it uses the option "MaxRows" to show only the first five results.
You may also use the option "SortingColumns" to specify how to sort the data. This option takes a list of rules. The left side of the rule specifies the column, and the right side specifies whether to sort that data in ascending or descending order. The first item in the list takes precedence over the supplemental items.
The details of how Wolfram Language expressions are mapped to types stored in the database is discussed in "Data Type Mapping".