This is documentation for Mathematica 6, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)
DatabaseLink Tutorial

Comparing Mathematica-Style Queries and SQL-Style Queries

DatabaseLink provides two styles of commands for working with data: one for those who are familiar with Mathematica and the other for those who are familiar with SQL. Mathematica style requires less knowledge of SQL. However, the Mathematica commands do not give complete coverage; thus, for more advanced queries, SQL-style commands may be preferred. The latter may also be desirable if you already have a knowledge of SQL.

Mathematica-Style Queries

DatabaseLink offers a number of functions for Mathematica-style queries.
The first six functions interact with the database. SQLMemberQ and SQLStringMatchQ are used for testing data in queries with conditions.

SQL-Style Queries

DatabaseLink can work with databases with raw SQL statements. This is useful if you already have a knowledge of SQL. Statements can be used to select data, create tables, insert data, update data, remove data, and drop tables. Typically these statements are passed to a command, SQLExecute. The statement used by SQLExecute is a string that can contain all arguments. However, it is also possible to give the arguments separately, which makes the statement a prepared statement. SQLExecute can also be used to execute a batch of prepared statements with different arguments, as described in Performance: Batch Operation.