How to Create, Use, and Drop a SQL Database?

A database contains records, and to create, modify, or delete these records SQL queries are used. An SQL query can either be an action query like delete or create or a select query like select or use. These queries are used to find specific data, perform actions on it, or just display data by filtering based on specific criteria.

Check out this comprehensive tutorial video on SQL:

A database is an organized collection of data. How do we create or insert data into the database? Well, that’s done by writing a database query. In this SQL Database tutorial section, we will discuss the queries related to the SQL Database

Become a Database Architect

How to Create a Database in SQL?

To Create a Database in SQL


CREATE DATABASE databasename;

where CREATE DATABASE is the keyword and databasename is the name of the database, followed by a semicolon.

Check our guide on DBMS Interview Questions and Answers for better presenting yourself in job interviews.

Here are the steps how to Create a Database in SQL

  • Open the SQL software and create a new query by clicking on New Query
  • Type the syntax and give a name for your database (Here, we are creating a database ‘happy’)
  • Then hit You will see that your commands are executed successfully, and your table is created.
  • Click on Refresh [ ] and you will find a database happy created in Object Explorer

Steps to Create a Database in SQL

Wish to get certified in SQL! Learn from our SQL expert and do excel in your career with Intellipaat’s SQL certification.

How do we Use a SQL Database?

To Select and use a Database in SQL


USE databasename;

where USE is the keyword, and databasename is the name that we want to use (select it from the existing database names), followed by a semicolon.
Once the database is selected, it remains default until another USE statement with a different database is used. To check which database you’re using, place your mouse pointer over the file where you’re executing the query.

Enroll now in SQL course in Bangalore to learn SQL concepts from experts.

How to Select a Database?

  • Here in the above image, the default database is the previously selected as SPARATA
  • To select the ‘happy’ database, give the command
USE happy;
  • Hit Execute and the database is selected

Steps 2 to Create a Database in SQL

How do we Delete or Drop a SQL Database?

To delete a database


DROP DATABASE databasename;

where DROP DATABASE is the keyword and databasename is the name of the database we want to delete, followed by semicolon.

Become a SQL Developer

Get familiar with the top SQL Interview Questions to get a head start in your career!

Delete a SQL Database

  • Here, we are deleting the igneous database; hence give the following command:
  • Then hit Execute and Click on Refresh [    ], and the igneous database would not be displayed on Object Explorer

Steps 3 to Create a Database in SQL
This bring us to the end of this SQL Database tutorial part. Now you’re ready to get started with creating and modifying your database! Now you know how to create a database in SQL. Meanwhile, there is a lot more you can do using SQL Database which we will see in the next tutorial sections.

Visit our SQL Community to get answers to all your queries!

Course Schedule

Name Date Details
SQL Training 24 Feb 2024(Sat-Sun) Weekend Batch
View Details
SQL Training 02 Mar 2024(Sat-Sun) Weekend Batch
View Details
SQL Training 09 Mar 2024(Sat-Sun) Weekend Batch
View Details

Leave a Reply

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