Q&A
Ask and answer questions to make information more available to wider audiences.
Aaliyah Kellogg @kelloggaaliyah   19, Jul 2023 12:00 AM
use database in MariaDB
How to use database in MariaDB?
answers 1
 
Answer 1
Aiden Barti @aidenbarti   09, Aug 2023 02:35 PM
USE DATABASE command is used to select and use a database in MariaDB. The USE db-name' statement tells MariaDB to use the db_name database as default (current) database for subsequent statements. The database remains the default until the end of the session, or another USE statement is issued:

Syntax:

USE database_name;     
Example

USE student;  
SELECT COUNT (*) FROM mytable;    # selects from student.mytable  
USE faculty;  
SELECT COUNT (*) FROM mytable;    # selects from faculty.mytable  
The DATABASE () and SCHEMA () returns the default database.