-
Notifications
You must be signed in to change notification settings - Fork 763
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/main' into replace
# Conflicts: # src/query/service/src/interpreters/interpreter_copy.rs
- Loading branch information
Showing
146 changed files
with
4,280 additions
and
663 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
docs/doc/14-sql-commands/00-ddl/10-database/ddl-use-database.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: USE DATABASE | ||
--- | ||
|
||
Selects a database for the current session. This statement allows you to specify and switch to a different database. Once you set the current database using this command, it remains the same until the end of the session unless you choose to change it. | ||
|
||
## Syntax | ||
|
||
```sql | ||
USE <database_name> | ||
``` | ||
|
||
## Examples | ||
|
||
```sql | ||
-- Create two databases | ||
CREATE DATABASE database1; | ||
CREATE DATABASE database2; | ||
|
||
-- Select and use "database1" as the current database | ||
USE database1; | ||
|
||
-- Create a new table "table1" in "database1" | ||
CREATE TABLE table1 ( | ||
id INT, | ||
name VARCHAR(50) | ||
); | ||
|
||
-- Insert data into "table1" | ||
INSERT INTO table1 (id, name) VALUES (1, 'John'); | ||
INSERT INTO table1 (id, name) VALUES (2, 'Alice'); | ||
|
||
-- Query all data from "table1" | ||
SELECT * FROM table1; | ||
|
||
-- Switch to "database2" as the current database | ||
USE database2; | ||
|
||
-- Create a new table "table2" in "database2" | ||
CREATE TABLE table2 ( | ||
id INT, | ||
city VARCHAR(50) | ||
); | ||
|
||
-- Insert data into "table2" | ||
INSERT INTO table2 (id, city) VALUES (1, 'New York'); | ||
INSERT INTO table2 (id, city) VALUES (2, 'London'); | ||
|
||
-- Query all data from "table2" | ||
SELECT * FROM table2; | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.