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 video on What is SQL Database and How to Create Database in 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
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.
CREATE DATABASE happy;
To Select and use a Database in SQL
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.
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.
DROP DATABASE igneous;
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.Previous Next
Download Interview Questions asked by top MNCs in 2019?