HOW TO CREATE A DATABASE IN SQL?

635 viewsSQLSQL
0

HOW TO CREATE A DATABASE IN SQL?

Saraswat World Changed status to publish June 14, 2023
0
CREATE DATABASE in SQL
CREATE 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;

Saraswat World Changed status to publish June 14, 2023
Write your answer.

Posted

in

Tags:

Comments

Leave a Reply

Ganesh Ji Arti A Tribute to Dilip Kumar