Google News
logo
MariaDB - Interview Questions
How to use database in MariaDB?
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.
Advertisement