CREATE DATABASE in SQL

HOW TO CREATE A DATABASE IN SQL?

To create a database in SQL the CREATE DATABASE statement is used. The database name should be unique and less than 128 characters.

To create a database in SQL and SQL Server use the command-

CREATE DATABASE database_name;

Example-

CREATE DATABASE student_db;

To view database in SQL use command-

SHOW DATABASE;

To Create or Replace existing database in SQL use command-

CREATE OR REPLACE DATABASE database_name ;

To list all databases stored in the SQL Server database engine use T-SQL command-

SELECT name FROM master.sys.databases ORDER BY name;

We can also use stored procedure โ€œsp_databasesโ€ in SQL server to view the list of all databases, including its size and remarks if any by executing the command-

EXEC sp_databases;


Posted

in

Tags:

Comments

Leave a Reply