Back to search

University of Alberta

Reasoning Across Relational Schemas with Large Language Models

Abstract

dc:description.abstract

Relational databases underpin modern information systems, yet real-world data environments are increasingly heterogeneous, distributed, and fragmented across schemas with differing structures, naming conventions, and semantics. Although large language models (LLMs) have shown strong performance in tasks such as Text-to-SQL generation and schema understanding, their ability to reason across multiple relational schemas remains poorly understood. This thesis investigates cross-schema relational reasoning in LLMs through three connected problems: cross-schema SQL query mapping, analysis of factors affecting mapping success, and schema reconstruction from fragmented databases. First, the thesis presents SQL-Exchange, a framework for transforming SQL queries across heterogeneous schemas while preserving source-query structure. Using schema-aware prompting, template-guided abstraction, and target-grounded value substitution, the framework enables structure-preserving query transfer across semantically different domains. Experiments show that LLMs can generate executable and semantically meaningful mappings, which further improve downstream Text-to-SQL performance, especially in low-resource settings. Second, the thesis analyzes why cross-schema SQL mappings succeed or fail. Using over 100,000 generated mappings, it examines the effects of query complexity, schema feasibility, and mapping flexibility on execution validity, semantic correctness, and structural preservation. Results indicate that complex query structures, schema incompatibilities, and ambiguous mappings significantly reduce performance, exposing key limitations of current LLMs under schema shift. Finally, the thesis studies whether LLMs can reconstruct coherent global schemas from fragmented local schemas in data integration scenarios. It introduces a benchmark for global schema construction based on real-world schemas subjected to controlled transformations, including naming drift, schema fragmentation, and removal of cross-source foreign keys. A deterministic evaluation framework measures executability, attribute recovery, and data reconstruction quality. Results show that even state-of-the-art reasoning LLMs struggle to recover globally consistent relational structures under high ambiguity and limited relational visibility. Overall, this thesis advances the study of schema-level reasoning in LLMs by introducing new methods, analyses, and benchmarks for relational reasoning across heterogeneous databases. The findings reveal both the promise and current limitations of LLMs in understanding, transferring, and reconstructing relational structure.

Degree

thesis:*
Name thesis:degree_name
Master of Science
Level thesis:degree_level
Master's
Grantor
University of Alberta
Year dc:date.issued
2026

Author and committee

dc:creator, dc:contributor.*
Author dc:creator
  • Daviran, Mohammadreza
Advisor dc:contributor.advisor
  • Rafiei, Davood (Computing Science)

Subjects

dc:subject × 9

Rights

dc:rights
Statement dc:rights
  • This thesis is made available by the University of Alberta Library with permission of the copyright owner solely for non-commercial purposes. This thesis, or any portion thereof, may not otherwise be copied or reproduced without the written consent of the copyright owner, except to the extent permitted by Canadian copyright law.
Language dc:language.iso
en

Identifiers

dc:identifier.*
DOI dc:identifier.doi
https://doi.org/10.7939/86057

Chain of custody

source
Harvested from
University of Alberta
Base URL
era.library.ualberta.ca/oai
Last updated
2026-11-26
Source record
OAI-PMH GetRecord
citation

Daviran, Mohammadreza. Reasoning Across Relational Schemas with Large Language Models. Master's thesis, University of Alberta, 2026. https://doi.org/10.7939/86057