Skip to content

USE ​

USE selects a registered server database. On a native connection, the selection remains in effect for later requests on that connection.

Syntax ​

text
USE database_name

Names are case-insensitive. The database must already be registered; create it with CREATE DATABASE.

Native and HTTP sessions ​

Native connections retain their selection. Each HTTP request has a separate logical session: use the database URL parameter or run USE and the dependent statements inside the same request.

A SELECT source named database.schema.table selects a managed database for that statement without changing the connection selection.

Example ​

Creating and selecting a database ​

sql
CREATE DATABASE IF NOT EXISTS analytics_example;
sql
USE analytics_example;
text
Database changed to analytics_example.
sql
SELECT 1 AS connected
FORMAT csv;
text
1

See HTTP interface for per-request database selection and FROM for qualified sources.