Working with Information in Relational Databases

The Wolfram Language has integrated capabilities for accessing and computing with data in relational databases. The basic concept is that data in local or remote relational databases is mapped into entity stores in the Wolfram Language. Operations on entity stores are defined symbolically, and executed using SQL code that is custom generated for SQLite, MySQL, PostgreSQL, SQL Server and other supported databases.

Connecting to Databases

DatabaseReference reference to an external database (with authentication etc.)

RelationalDatabase symbolic representation of a relational database and its schema

DatabaseConnect, DatabaseDisconnect manually connect, disconnect

Registering Database Content

EntityStore symbolic representation of a database through an entity store

EntityRegister register entity types so they can be referenced directly

EntityUnregister  ▪  EntityStores

EntityClass representation of a table or virtual table in a database

Entity a single entity, corresponding to a row in a database table

EntityValue, entity[property] extract values by performing a database query

EntityList get a list of entities by performing a database query

EntityProperty symbolic representation of a property (typically column name)

EntityFunction pure function representation of a database expression or subquery

EmbeddedSQLExpression raw SQL to be used within an EntityFunction

Representations of Transformations on Entity Classes

FilteredEntityClass entity class filtered by a criterion

SortedEntityClass entity class sorted by properties or functions

SampledEntityClass entity class formed by sampling a number of entities

AggregatedEntityClass entity class formed by aggregating entities

ExtendedEntityClass entity class with properties added for each entity

CombinedEntityClass entity class formed by combining properties across entity classes

UnionedEntityClass entity class representing the union of multiple entity classes

IntersectedEntityClass entity class representing the intersection of multiple entity classes

ComplementedEntityClass entity class representing the complement of multiple entity classes

EmbeddedSQLEntityClass entity class defined using raw SQL

Direct SQL Execution

ExternalEvaluate run an SQL command in a database and return the result

StartExternalSession open an external database connection

"SQL"  ▪  "SQL-JDBC"  ▪  RegisterExternalEvaluator

Supported Database Connections

"MicrosoftSQL"  ▪  "MySQL"  ▪  "Oracle"  ▪  "PostgreSQL"  ▪  "SQLite"