beginnersbook.com

  • Home
  • All Tutorials
    • Learn Servlet
    • Learn JSP
    • Learn JSTL
    • Learn C
    • Learn C++
    • Learn MongoDB
    • Learn XML
    • Learn Python
    • Learn Perl
    • Learn Kotlin
  • Core Java
  • OOPs
  • Collections
  • Java I/O
  • JSON
  • DBMS

SQL – SELECT Database Statement

By Chaitanya Singh | Filed Under: SQL

Generally we have more than one databases in DBMS (Database management system). To select a database out of the available databases in SQL schema, we use USE Statement.

Syntax:

USE DBName;

USE statement Example –

SQL> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| AbcTest            |
| Test               |
| Demo               |
| DB1                |
+--------------------+
4 rows in set (0.00 sec)

Lets say we have above four databases in our Database management system. To use the Database “DB1” we can use the USE Statement like this:

USE DB1;

After this statement whatever operation you will perform like Create table, delete table etc. would be performed on the database “DB1”. Lets say after making modification, you may want to work with another database “Demo” then you can simply change the database like this:

USE Demo;

Enjoyed this post? Try these related posts

  1. SQL WHERE Clause
  2. SQL SELECT MIN, MAX Functions
  3. DEFAULT Constraint in SQL
  4. SQL SELECT TOP Statement
  5. Introduction to SQL
  6. SQL AND, OR and NOT Operators with examples

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

SQL Tutorial

  • SQL Introduction
  • SQL Syntax
  • SQL Select
  • SQL Select Distinct
  • SQL Select Count
  • SQL Select Top
  • SQL Where
  • SQL AND, OR & NOT
  • SQL Order By
  • SQL Insert Into
  • SQL Insert Into SELECT
  • SQL Select Random
  • SQL Alias
  • SQL NULL Check
  • SQL Update
  • SQL Delete
  • SQL MIN, MAX
  • SQL SUM
  • SQL AVG

Recently Added..

  • JSON Tutorial
  • Java Regular Expressions Tutorial
  • Java Enum Tutorial
  • Java Annotations Tutorial

Copyright © 2012 – 2019 BeginnersBook . Privacy Policy . Sitemap