SQLSelect
Details and Options
- To use SQLSelect, you first need to load DatabaseLink using Needs["DatabaseLink`"].
- The following options can be given:
-
"Distinct" False whether to return only distinct results "FetchSize" Automatic JDBC driver hint for filling result sets "GetAsStrings" False whether to return the results as strings "MaxFieldSize" Automatic byte limit for variable-length column types "MaxRows" Automatic the maximum number of rows to return "ShowColumnHeadings" False whether to return headings with the results "SortingColumns" None how to sort the data "ColumnSymbols" None symbols to be associated with results "Timeout" $SQLTimeout the timeout for the query
Examples
open allclose allBasic Examples (1)Summary of the most common use cases

https://wolfram.com/xid/0dgff8fzdhn69e-mppzkx
If you find that the examples in this section 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.

https://wolfram.com/xid/0dgff8fzdhn69e-f2hc2y

https://wolfram.com/xid/0dgff8fzdhn69e-mr1


https://wolfram.com/xid/0dgff8fzdhn69e-skm

Join data from multiple tables:

https://wolfram.com/xid/0dgff8fzdhn69e-br9

Select data matching a condition:

https://wolfram.com/xid/0dgff8fzdhn69e-ylf

Select data matching a pattern:

https://wolfram.com/xid/0dgff8fzdhn69e-f68


https://wolfram.com/xid/0dgff8fzdhn69e-y0g


https://wolfram.com/xid/0dgff8fzdhn69e-ex8


https://wolfram.com/xid/0dgff8fzdhn69e-ew1
Scope (1)Survey of the scope of standard use cases

https://wolfram.com/xid/0dgff8fzdhn69e-d3tv02

https://wolfram.com/xid/0dgff8fzdhn69e-qmq
Select data matching a condition:

https://wolfram.com/xid/0dgff8fzdhn69e-xpc


https://wolfram.com/xid/0dgff8fzdhn69e-s2k


https://wolfram.com/xid/0dgff8fzdhn69e-wm0


https://wolfram.com/xid/0dgff8fzdhn69e-dzh


https://wolfram.com/xid/0dgff8fzdhn69e-i0t


https://wolfram.com/xid/0dgff8fzdhn69e-wju


https://wolfram.com/xid/0dgff8fzdhn69e-crg

Combine conditions using And and Or:

https://wolfram.com/xid/0dgff8fzdhn69e-lig


https://wolfram.com/xid/0dgff8fzdhn69e-kxh


https://wolfram.com/xid/0dgff8fzdhn69e-nn8
Options (8)Common values & functionality for each option
"Distinct" (1)
"FetchSize" (1)

https://wolfram.com/xid/0dgff8fzdhn69e-yiasat
The "FetchSize" option suggests to the JDBC driver a number of rows to fetch on each visit to the database. Increasing this parameter reduces the amount of network traffic required to execute a query, at the cost of memory used:

https://wolfram.com/xid/0dgff8fzdhn69e-8kx3j4

Compute memory in use, including both kernel and Java layers:

https://wolfram.com/xid/0dgff8fzdhn69e-ytl7m8

https://wolfram.com/xid/0dgff8fzdhn69e-8wg1yq

Fetch a large result with a small fetch size:

https://wolfram.com/xid/0dgff8fzdhn69e-6a3xz5


https://wolfram.com/xid/0dgff8fzdhn69e-5n5t15


https://wolfram.com/xid/0dgff8fzdhn69e-oemuqn

Fetch a large result with a large fetch size:

https://wolfram.com/xid/0dgff8fzdhn69e-5mg6ih


https://wolfram.com/xid/0dgff8fzdhn69e-j1u7i1


https://wolfram.com/xid/0dgff8fzdhn69e-lh0xx3
"GetAsStrings" (1)
"MaxFieldSize" (1)

https://wolfram.com/xid/0dgff8fzdhn69e-zv1dkg
For some variable-length column types the "MaxFieldSize" option can be used to limit the number of bytes returned for a field:

https://wolfram.com/xid/0dgff8fzdhn69e-se0adk

Create a table with a VARCHAR field:

https://wolfram.com/xid/0dgff8fzdhn69e-wsybkx


https://wolfram.com/xid/0dgff8fzdhn69e-388mg0

Select string contents, limiting byte length of results:

https://wolfram.com/xid/0dgff8fzdhn69e-fk3eis


https://wolfram.com/xid/0dgff8fzdhn69e-f9vakd


https://wolfram.com/xid/0dgff8fzdhn69e-6fdivw


https://wolfram.com/xid/0dgff8fzdhn69e-wc311n
"MaxRows" (1)
"ShowColumnHeadings" (1)
"SortingColumns" (1)
"ColumnSymbols" (1)

https://wolfram.com/xid/0dgff8fzdhn69e-el9e2l
Supply a list of symbols for query results to be assigned to:

https://wolfram.com/xid/0dgff8fzdhn69e-j96qh7

https://wolfram.com/xid/0dgff8fzdhn69e-zybkcs

https://wolfram.com/xid/0dgff8fzdhn69e-r520cd


https://wolfram.com/xid/0dgff8fzdhn69e-v1sigx


https://wolfram.com/xid/0dgff8fzdhn69e-1f7xby


https://wolfram.com/xid/0dgff8fzdhn69e-y7o6p9

https://wolfram.com/xid/0dgff8fzdhn69e-l2g8mx


https://wolfram.com/xid/0dgff8fzdhn69e-eebc8u


https://wolfram.com/xid/0dgff8fzdhn69e-ipj4p8


https://wolfram.com/xid/0dgff8fzdhn69e-6auuuc

Supply a function to operate on column names and results. If column headings have not been requested, the first argument to the function will be Null:

https://wolfram.com/xid/0dgff8fzdhn69e-s73t1i


https://wolfram.com/xid/0dgff8fzdhn69e-ny4ec8


https://wolfram.com/xid/0dgff8fzdhn69e-rhigon


https://wolfram.com/xid/0dgff8fzdhn69e-8pyj6w

https://wolfram.com/xid/0dgff8fzdhn69e-h07ubr


https://wolfram.com/xid/0dgff8fzdhn69e-i1boqa
Applications (1)Sample problems that can be solved with this function

https://wolfram.com/xid/0dgff8fzdhn69e-dd4pqu

https://wolfram.com/xid/0dgff8fzdhn69e-ozw

https://wolfram.com/xid/0dgff8fzdhn69e-r4e


https://wolfram.com/xid/0dgff8fzdhn69e-vc6bnf


https://wolfram.com/xid/0dgff8fzdhn69e-el4