SQL USE Database Statement Last Updated : 27 Dec, 2024 Comments Improve Suggest changes Like Article Like Report SQL(Structured Query Language) is a standard Database language that is used to create, maintain and retrieve the data from relational databases like MySQL, Oracle, etc. It is flexible and user-friendly. In SQL, to interact with the database, the users have to type queries that have certain syntax, and use command is one of them. The use command is used when there are multiple databases in the SQL and the user or programmer specifically wants to use a particular database. Thus, in simple terms, the use statement selects a specific database and then performs operations on it using the inbuilt commands of SQL.Syntax:USE database_name;Example 1:The user wants to works on the databases named "GEEKS". So the user will write:USE candy;Example 2:Before using any database using the use command, it's necessary to first create it. In order to create a database in SQL, the following command is used. Here, we create a database named "GFG1":CREATE DATABASE GFG1Now, after the user has created a database named candy, we can use this database to perform the database operations. So, for that, the user has to type the USE command as follows:USE GFG1After performing desired operations on the database, if we do not want the database, We can drop the database using the DROP command:DROP DATABASE GFG1Remember, once a database is dropped, it's removed permanently from the list of available databases, there is no way to retrieve the data of the table or the complete database in any possible way.After using the drop command, if the user types -USE GFG1The SQL database will throw an error as the GFG1 database has been removed permanently from the database using the drop command. Comment More infoAdvertise with us Next Article SQL USE Database Statement P pradiptamukherjee Follow Improve Article Tags : SQL Computer Science Fundamentals School Learning Class 12 SQL-Query +1 More Similar Reads SQL CASE Statement The CASE statement in SQL is a versatile conditional expression that enables us to incorporate conditional logic directly within our queries. It allows you to return specific results based on certain conditions, enabling dynamic query outputs. Whether you need to create new columns, modify existing 4 min read SQL CREATE VIEW Statement The SQL CREATE VIEW statement is a very powerful feature in RDBMSs that allows users to create virtual tables based on the result set of a SQL query. Unlike regular tables, these views do not store data themselves rather they provide a way of dynamically retrieving and presenting data from one or ma 4 min read SQL DELETE Statement The SQL DELETE statement is one of the most commonly used commands in SQL (Structured Query Language). It allows you to remove one or more rows from the table depending on the situation. Unlike the DROP statement, which removes the entire table, the DELETE statement removes data (rows) from the tabl 4 min read PL/SQL CASE Statement PL/SQL stands for Procedural Language Extension to the Structured Query Language and it is designed specifically for Oracle databases it extends Structured Query Language (SQL) capabilities by allowing the creation of stored procedures, functions, and triggers. The PL/SQL CASE statement is a powerfu 4 min read MySQL DELETE Statement In DBMS, CRUD operations (Create, Read, Update, Delete) are essential for effective data management. The Delete operation is crucial for removing data from a database. This guide covers the MySQL DELETE statement, exploring its syntax and providing examples. Understanding how DELETE works helps ensu 6 min read SQL UPDATE Statement In SQL, the UPDATE statement is used to modify existing records in a table. Whether you are updating a single record or multiple records at once, SQL provides the necessary functionality to make these changes. Whether you are working with a small dataset or handling large-scale databases, the UPDATE 6 min read SQL SERVER | Conditional Statements While loop: In SQL SERVER, while loop can be used in similar manner as any other programming language. A while loop will check the condition first and then execute the block of SQL Statements within it as long as the condition evaluates true. Syntax: WHILE condition BEGIN {...statements...} END; Par 2 min read SQL Select Database The USE DATABASE statement is a command in certain SQL-based database management systems that allows users to select and set a specific database as the default for the current session. By selecting a database, subsequent queries are executed within the context of that database, making it easier to i 4 min read Instance in Database An instance shows the data or information that is stored in the database at a specific point in time. In this article we will come to know about, what is Instances in databases. We will see two examples related to it as well. But first of all, let us know about some terminologies related to it. Prim 3 min read SQL SELECT IN Statement The IN operator in SQL is used to compare a column's value against a set of values. It returns TRUE if the column's value matches any of the values in the specified list, and FALSE if there is no match.In this article, we will learn how IN operator works and provide practical examples to help you be 3 min read Like