# Programming Derby-style table functions

Derby lets you create table functions. Table functions are functions which package up external data to look like Derby tables. The external data can be an XML file, a table in a foreign database, a live data feed--in short, any information source that can be presented as a JDBC ResultSet.

Derby-style table functions let you efficiently import foreign data into Derby tables. Table functions let you join Derby tables with any of the following data sources:

- XML-formatted reports and logs
- Queries that run in foreign databases
- Streaming data from sensors
- RSS feeds

See "CREATE FUNCTION statement" in the Java DB Reference Manual for the complete syntax needed to declare Derby-style table functions. The following topics provide information on how to write Java methods which wrap foreign data sources inside ResultSets.

- Overview of Derby-style table functions
  A Derby-style table function is a method which returns a JDBC ResultSet.
- Example Derby-style table function
  The following simple table function selects rows from a foreign database.
- Optimizer support for Derby-style table functions
  This topic explains how to fine-tune the Derby optimizer's decision about where to place a table function in the join order.

Parent topic: Derby server-side programming