C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
SQL SELECT DatabaseSuppose database users and administrators want to perform some operations on tables, views, and indexes on the specific existing database in SQL. Firstly, they have to select the database on which they want to run the database queries. Any database user and administrator can easily select the particular database from the current database server using the USE statement in SQL. Syntax of USE statement in SQLUSE database_name; In this syntax, we have to define the name of the database after the USE keyword and the name of the database must be unique. Syntax of USE statement in MySQLUSE database_name; Syntax of USE statement in OracleThere is no need to select the database in Oracle. Examples of USE statement in SQLIn this article, we have taken the following three examples which will help you how to run and perform USE statement in SQL: Example 1: Suppose, you want to work with the Hospital database. For this firstly, you have to check that if the Hospital database exists on the current database server or not by using the following query: SHOW DATABASES; If the Hospital database is shown in the output, then you have to execute the following query to select the Hospital database: USE Hospital; Example 2: Suppose, you want to work with another College database in SQL. For this firstly, you have to check that the College database exists on the current database server or not by using the following query: SHOW DATABASES; If the College database is shown in the result, then you have to execute the following query to select the College database: USE College; Example 3: Suppose you want to work with another School database in SQL. For this firstly, you have to check that the School database exists on the current database server or not by using the following query: SHOW DATABASES; If the School database is shown in the result, then you have to execute the following query to select the School database: USE School;
Next TopicSql TABLE
|