Advanced
Variables
Define and use variables across queries.
Session Variables
Define variables that persist across query tabs for the current session:
-- Set a variable
SET @user_id = 42;
-- Use it in queries
SELECT * FROM orders WHERE user_id = @user_id;Environment Variables
Relay supports environment-specific variables for switching between development, staging, and production configurations.
Configure them in Settings → Variables.
Variable Types
| Type | Scope |
|---|---|
| Session | Current connection session |
| Environment | Per-environment, persisted |
| Template | Prompted on each execution |