Does iDBQuery need foreign keys defined to join my tables correctly?
No — iDBQuery does not require declared foreign keys. It uses them when they exist, but where a database has none it infers relationships from matching column names, data types, value overlap, and its semantic layer, then writes the join and cites results so you can confirm it linked the right keys.
Plenty of real databases lack formal foreign-key constraints, especially older schemas, analytics copies, or spreadsheets and CSVs. iDBQuery is built for that reality.
- When keys exist, it reads them during introspection and uses them as the most reliable join hints.
- When they don't, it falls back to other evidence: columns with matching names and compatible types (`account_id` to `account_id`), typical naming conventions, and value overlap between candidate keys.
- The semantic layer lets you or the auto-enrichment step record relationships explicitly, so once a join is learned it is reused on every future question.
Because files like Excel and CSV never carry foreign keys at all, this inference is essential for iDBQuery's core promise of one live queryable model across databases, spreadsheets, and documents. If a link is uncertain, iDBQuery asks a clarifying question instead of quietly guessing. And since every answer shows the SQL and cites figures back to their exact source rows, you always have a way to verify that the join matched the columns you intended — no data-modelling project required first.
Updated 2026-06-22