AMPL’s relational database facility provides a convenient mechanism for accessing data in spreadsheets and databases. A flexible table declaration defines correspondences between sets, parameters, variables, and expressions in AMPL models and external tables managed by database systems or spreadsheet applications. The read table and write table commands use these correspondences to import data values into AMPL and to export data and solution values from AMPL.