SlideShare a Scribd company logo
1 of 18
Creating a Database
SQL Create Database
• In SQL, the 'Create Database' statement is a first step for
storing the structured data in the database.
• this statement in SQL for creating the new database in the
database systems.
• It creates the database with the name which has been specified
in the Create Database statement.
Syntax of Create Database statement in
SQL
• CREATE DATABASE Database_Name;
Note - Database_Name specifies the name of the database
which we want to create in the system. We have to type the
database name in query just after the 'Create Database'
keyword.
Points to remember while creating a database
• The database we want to create should be a simple and unique
name, which can be easily identified.
• Database name should be no more than 128 characters.
Example :
CREATE DATABASE Student ;
Output - Database created successfully
Note
• SQL does not allow developers to create the database with the
existing database name.
• Suppose if you want to create another Student database in the
same database system, then the Create Database statement
will show the following error in the output: -
Can't create database 'Student'; database exists
To Replace the existing database
• you have to delete the existing database by using the Drop
Statement
• Or you can also replace the existing database with the help of
Replace keyword.
CREATE OR REPLACE DATABASE Student ;
Example :
we want to create the Employee database in the system. –
CREATE DATABASE Employee ;
You can also verify that your database is created in SQL or not by
using the following query:
SHOW DATABASE ;
To replace the existing Employee database with a new Employee
database:-
CREATE OR REPLACE DATABASE Employee;
SQL DROP Database
• The SQL Drop Database statement deletes the existing
database permanently from the database system.
*This statement deletes all the views and tables
if stored in the database, so be careful while using
this query in SQL.
Following are the most important points which are
required to learn before removing the database from the
database system:-
This statement deletes all the data from the database. If you want to restore the
deleted data in the future, you should keep the backup of data of that database
which you want to delete.
Another most important point is that you cannot delete that database from the
system which is currently in use by another database user. If you do so, then the
drop statement shows the following error on screen:
Cannot drop database "name_of_the_database" because it is currently in use.
Syntax of Drop Database Statement in
SQL
• DROP DATABASE Database_Name;
Note - In this SQL syntax, we have to specify the name of that
database which we want to delete permanently from the
database system. We have to write the name of the database
after the DROP DATABASE keyword in every example.
We can also delete multiple databases easily by using the
single DROP syntax:
DROP DATABASE Database_Name1, [ Database_Name
2, .......,
Database_NameN ] ;
we have no need to write multiple statements for deleting multiple
databases.
Example:
• we want to delete the Student database with all its data from the database
system.
• so, firstly we have to check that the Student database exists in the system
or not by using the following statement:
SHOW DATABASES ;
If the Student database is shown in the output, then we have to type the
following query in SQL for removing the Student database:
DROP DATABASE Student;
if the Student database does not exist in the database system –
• Can't drop database 'Student'; database doesn't exist
SQL RENAME Database
• the Rename Database statement in SQL is used to change the
name of the existing database.
Syntax :-
ALTER DATABASE old_database_name MODIFY NAME
=
new_database_name;
Example:-
ALTER DATABASE Student MODIFY NAME = College ;
SQL SELECT Database
• Suppose database users and administrators want to perform
some operations on tables, views, and indexes on the specific
existing database in SQL
• 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 SQL
USE database_name;
Note - 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.
Examples of 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;
To Be Continue…….

More Related Content

Similar to Create Database in SQL - A Concise Guide to the CREATE, DROP, RENAME and SELECT Statements

Sql server 2012 tutorials writing transact-sql statements
Sql server 2012 tutorials   writing transact-sql statementsSql server 2012 tutorials   writing transact-sql statements
Sql server 2012 tutorials writing transact-sql statementsSteve Xu
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptxSheethal Aji Mani
 
Crucial Tips to Improve MySQL Database Performance.pptx
Crucial Tips to Improve MySQL Database Performance.pptxCrucial Tips to Improve MySQL Database Performance.pptx
Crucial Tips to Improve MySQL Database Performance.pptxTosska Technology
 
OER-Unit 1 authentication -Lecturer Notes
OER-Unit 1 authentication -Lecturer NotesOER-Unit 1 authentication -Lecturer Notes
OER-Unit 1 authentication -Lecturer NotesGirija Muscut
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfTamiratDejene1
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data RedactionAlex Zaballa
 
The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer ...
The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer  ...The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer  ...
The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer ...ParshantiniRoy
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptxKulbir4
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL IISankhya_Analytics
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptxEllenGracePorras
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETEAbrar ali
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptxnatesanp1234
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL ISankhya_Analytics
 

Similar to Create Database in SQL - A Concise Guide to the CREATE, DROP, RENAME and SELECT Statements (20)

Sql server 2012 tutorials writing transact-sql statements
Sql server 2012 tutorials   writing transact-sql statementsSql server 2012 tutorials   writing transact-sql statements
Sql server 2012 tutorials writing transact-sql statements
 
Relational Database Language.pptx
Relational Database Language.pptxRelational Database Language.pptx
Relational Database Language.pptx
 
1.1 sql create and drop database statement
1.1 sql create and drop database statement1.1 sql create and drop database statement
1.1 sql create and drop database statement
 
Crucial Tips to Improve MySQL Database Performance.pptx
Crucial Tips to Improve MySQL Database Performance.pptxCrucial Tips to Improve MySQL Database Performance.pptx
Crucial Tips to Improve MySQL Database Performance.pptx
 
OER-Unit 1 authentication -Lecturer Notes
OER-Unit 1 authentication -Lecturer NotesOER-Unit 1 authentication -Lecturer Notes
OER-Unit 1 authentication -Lecturer Notes
 
Chapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdfChapter – 6 SQL Lab Tutorial.pdf
Chapter – 6 SQL Lab Tutorial.pdf
 
Oracle Data Redaction
Oracle Data RedactionOracle Data Redaction
Oracle Data Redaction
 
The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer ...
The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer  ...The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer  ...
The Ultimate Guide to Upgrade ocp java 6, 7 & 8 to java se 11 developer ...
 
SQL PPT.pptx
SQL PPT.pptxSQL PPT.pptx
SQL PPT.pptx
 
Sql server basics
Sql server basicsSql server basics
Sql server basics
 
Sq lite
Sq liteSq lite
Sq lite
 
Getting Started with MySQL II
Getting Started with MySQL IIGetting Started with MySQL II
Getting Started with MySQL II
 
Unit - II.pptx
Unit - II.pptxUnit - II.pptx
Unit - II.pptx
 
SQL_NOTES.pdf
SQL_NOTES.pdfSQL_NOTES.pdf
SQL_NOTES.pdf
 
Structured Query Language (SQL).pptx
Structured Query Language (SQL).pptxStructured Query Language (SQL).pptx
Structured Query Language (SQL).pptx
 
Mysql grand
Mysql grandMysql grand
Mysql grand
 
Database COMPLETE
Database COMPLETEDatabase COMPLETE
Database COMPLETE
 
DBMS LAB M.docx
DBMS LAB M.docxDBMS LAB M.docx
DBMS LAB M.docx
 
PHP and MySQL.pptx
PHP and MySQL.pptxPHP and MySQL.pptx
PHP and MySQL.pptx
 
Getting Started with MySQL I
Getting Started with MySQL IGetting Started with MySQL I
Getting Started with MySQL I
 

More from adityakumawat625

More from adityakumawat625 (14)

Data Analytics.pptx
Data Analytics.pptxData Analytics.pptx
Data Analytics.pptx
 
Python Tuples.pptx
Python Tuples.pptxPython Tuples.pptx
Python Tuples.pptx
 
Python Operators.pptx
Python Operators.pptxPython Operators.pptx
Python Operators.pptx
 
Python Lists.pptx
Python Lists.pptxPython Lists.pptx
Python Lists.pptx
 
Python Data Types,numbers.pptx
Python Data Types,numbers.pptxPython Data Types,numbers.pptx
Python Data Types,numbers.pptx
 
Python comments and variables.pptx
Python comments and variables.pptxPython comments and variables.pptx
Python comments and variables.pptx
 
Python Variables.pptx
Python Variables.pptxPython Variables.pptx
Python Variables.pptx
 
Python Strings.pptx
Python Strings.pptxPython Strings.pptx
Python Strings.pptx
 
python intro and installation.pptx
python intro and installation.pptxpython intro and installation.pptx
python intro and installation.pptx
 
sql datatypes.pptx
sql datatypes.pptxsql datatypes.pptx
sql datatypes.pptx
 
sql_operators.pptx
sql_operators.pptxsql_operators.pptx
sql_operators.pptx
 
SQL Tables.pptx
SQL Tables.pptxSQL Tables.pptx
SQL Tables.pptx
 
SQL syntax.pptx
SQL syntax.pptxSQL syntax.pptx
SQL syntax.pptx
 
Introduction to SQL.pptx
Introduction to SQL.pptxIntroduction to SQL.pptx
Introduction to SQL.pptx
 

Recently uploaded

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 

Recently uploaded (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Naraina Delhi 💯Call Us 🔝8264348440🔝
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 

Create Database in SQL - A Concise Guide to the CREATE, DROP, RENAME and SELECT Statements

  • 2. SQL Create Database • In SQL, the 'Create Database' statement is a first step for storing the structured data in the database. • this statement in SQL for creating the new database in the database systems. • It creates the database with the name which has been specified in the Create Database statement.
  • 3. Syntax of Create Database statement in SQL • CREATE DATABASE Database_Name; Note - Database_Name specifies the name of the database which we want to create in the system. We have to type the database name in query just after the 'Create Database' keyword.
  • 4. Points to remember while creating a database • The database we want to create should be a simple and unique name, which can be easily identified. • Database name should be no more than 128 characters. Example : CREATE DATABASE Student ; Output - Database created successfully
  • 5. Note • SQL does not allow developers to create the database with the existing database name. • Suppose if you want to create another Student database in the same database system, then the Create Database statement will show the following error in the output: - Can't create database 'Student'; database exists
  • 6. To Replace the existing database • you have to delete the existing database by using the Drop Statement • Or you can also replace the existing database with the help of Replace keyword. CREATE OR REPLACE DATABASE Student ;
  • 7. Example : we want to create the Employee database in the system. – CREATE DATABASE Employee ; You can also verify that your database is created in SQL or not by using the following query: SHOW DATABASE ; To replace the existing Employee database with a new Employee database:- CREATE OR REPLACE DATABASE Employee;
  • 8. SQL DROP Database • The SQL Drop Database statement deletes the existing database permanently from the database system. *This statement deletes all the views and tables if stored in the database, so be careful while using this query in SQL.
  • 9. Following are the most important points which are required to learn before removing the database from the database system:- This statement deletes all the data from the database. If you want to restore the deleted data in the future, you should keep the backup of data of that database which you want to delete. Another most important point is that you cannot delete that database from the system which is currently in use by another database user. If you do so, then the drop statement shows the following error on screen: Cannot drop database "name_of_the_database" because it is currently in use.
  • 10. Syntax of Drop Database Statement in SQL • DROP DATABASE Database_Name; Note - In this SQL syntax, we have to specify the name of that database which we want to delete permanently from the database system. We have to write the name of the database after the DROP DATABASE keyword in every example.
  • 11. We can also delete multiple databases easily by using the single DROP syntax: DROP DATABASE Database_Name1, [ Database_Name 2, ......., Database_NameN ] ; we have no need to write multiple statements for deleting multiple databases.
  • 12. Example: • we want to delete the Student database with all its data from the database system. • so, firstly we have to check that the Student database exists in the system or not by using the following statement: SHOW DATABASES ; If the Student database is shown in the output, then we have to type the following query in SQL for removing the Student database: DROP DATABASE Student; if the Student database does not exist in the database system – • Can't drop database 'Student'; database doesn't exist
  • 13. SQL RENAME Database • the Rename Database statement in SQL is used to change the name of the existing database. Syntax :- ALTER DATABASE old_database_name MODIFY NAME = new_database_name; Example:- ALTER DATABASE Student MODIFY NAME = College ;
  • 14. SQL SELECT Database • Suppose database users and administrators want to perform some operations on tables, views, and indexes on the specific existing database in SQL • 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
  • 15. Syntax of USE statement in SQL USE database_name; Note - 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.
  • 16. Examples of 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;
  • 17. 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;