The SQL collection provides a powerful method for retrieving data using SQL queries. By extracting data fields through SQL queries and configuring the associated field metadata, users can utilize these fields as though they were working with a standard table. This feature is particularly beneficial for scenarios involving complex join queries, statistical analysis, and more.
If you need to modify the SQL query, click the Edit button to directly alter the SQL statement and reconfigure the fields as needed.
To adjust the field metadata, use the Configure Fields option, which allows you to update the field settings just as you would for a regular table.
If the SQL query remains unchanged but the underlying database table structure has been modified, you can synchronize and reconfigure the fields by selecting Configure Fields - Sync from Database.
| Template Type | Best Suited For | Implementation Method | Support for CRUD Operations |
|---|---|---|---|
| SQL | Simple models, lightweight use cases Limited interaction with the database Avoiding maintenance of views Prefer UI-driven operations | SQL subquery | Not Supported |
| Connect to database view | Complex models Requires database interaction Data modification needed Requires stronger and more stable database support | Database view | Partially Supported |
When using SQL collection, be sure to select tables that are manageable within NocoBase. Using tables from the same database that are not connected to NocoBase may lead to inaccurate SQL query parsing. If this is a concern, consider creating and linking to a view.