matlab-read-database

Import relational data into MATLAB tables with database-side filtering and joins.

883|109|Updated Apr 3, 2026
One-click install
npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-read-database
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: matlab-read-database
Source: https://github.com/matlab/matlab-agentic-toolkit/tree/main/skills-catalog/reporting-and-database-access/matlab-read-database
Command: npx skills add https://github.com/matlab/matlab-agentic-toolkit --skill matlab-read-database

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This skill prevents slow, memory-heavy MATLAB imports by ensuring row filtering, column selection, deduplication, and supported 2-table joins are executed on the relational database using MATLAB Database Toolbox pushdown capabilities.

Core Features & Use Cases

  • Efficient imports with pushdown: Use sqlread for database tables and fetch for SQL queries so filtering and selected columns happen on the database side.
  • Correct, scalable filtering and deduplication: Use RowFilter and databaseImportOptions (including SelectedVariableNames and ExcludeDuplicates) to avoid importing everything and filtering in MATLAB.
  • Safe join strategy: Use sqlinnerjoin/sqlouterjoin for exactly two tables (with RowFilter), and fall back to explicit SQL via fetch for 3+ tables, aggregation, and complex queries.

Quick Start

Use matlab-read-database to import only needed columns and rows from a relational database table by applying RowFilter and SelectedVariableNames with sqlread, then use sqlinnerjoin/sqlouterjoin for a two-table join or fetch with explicit SQL for more complex multi-table/aggregation queries.

Frequently Asked Questions about matlab-read-database

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I import relational database data into MATLAB without loading unnecessary rows?

To import relational data efficiently, use sqlread with RowFilter and databaseImportOptions to push row filtering and column selection directly to the database engine, ensuring MATLAB only receives the needed subset of data.

What is the best way to filter rows and select specific columns when reading a database table in MATLAB?

The best way to filter rows and select columns is applying RowFilter and SelectedVariableNames via databaseImportOptions, then passing these options to sqlread so the database executes the filtering instead of MATLAB.

Can I perform table joins directly on the database when importing data into MATLAB?

Yes, you can push two-table joins to the database by using sqlinnerjoin or sqlouterjoin with a RowFilter applied, which prevents importing large tables into MATLAB before combining them.

How do I handle multi-table joins or SQL aggregations in MATLAB Database Toolbox?

For complex queries involving three or more tables, aggregations, or multi-table joins, bypass pushdown functions and use fetch with explicit SQL statements to execute the query on the database side.

Does MATLAB sqlread support excluding duplicate rows during database imports?

Yes, sqlread supports excluding duplicates by configuring the ExcludeDuplicates property within databaseImportOptions, pushing the deduplication process to the database before the data reaches MATLAB.

What are the limitations of using sqlinnerjoin and sqlouterjoin for database reads in MATLAB?

The limitation is that sqlinnerjoin and sqlouterjoin only support exactly two tables and cannot accept databaseImportOptions; RowFilter must be applied separately, requiring fallback to fetch for complex queries.