docs/content/v2.20/api/ycql/ddl_use.md
Use the USE statement to specify a default keyspace for the current client session. When a database object (such as table or type) name does not identify a keyspace, this default keyspace is used.
<svg class="rrdiagram" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" width="181" height="35" viewbox="0 0 181 35"><path class="connector" d="M0 22h5m45 0h10m116 0h5"/><rect class="literal" x="5" y="5" width="45" height="25" rx="7"/><text class="text" x="15" y="22">USE</text><a xlink:href="../grammar_diagrams#keyspace-name"><rect class="rule" x="60" y="5" width="116" height="25"/><text class="text" x="70" y="22">keyspace_name</text></a></svg>
use_keyspace ::= USE keyspace_name;
Where
keyspace_name must be an identifier that cannot be any reserved keyword and cannot contains whitespaces, or it has to be double-quoted.ycqlsh> CREATE KEYSPACE example;
ycqlsh> CREATE KEYSPACE other_keyspace;
ycqlsh> USE example;
ycqlsh:example> CREATE TABLE test(id INT PRIMARY KEY);
ycqlsh:example> INSERT INTO test(id) VALUES (1);
ycqlsh:example> SELECT * FROM test;
id
----
1
ycqlsh:example> CREATE TABLE other_keyspace.test(id INT PRIMARY KEY);
ycqlsh:example> INSERT INTO other_keyspace.test(id) VALUES (2);
ycqlsh:example> SELECT * FROM other_keyspace.test;
id
----
2