Creating database From GUI:-
Create Database from Query
To create a database on a SQL Server instance, execute the command
below. We must be logged into the server and have the necessary permissions in
order to build a database (CREATE DATABASE, CREATE ANY DATABASE, or ALTER ANY
DATABASE).
where "database-name" is the name of the database that will be
made, and it must adhere to the following rules:
On the SQL Server instance, it must be distinct.
When using the CREATE DATABASE command, the log and data file names
(which need to be 128 characters long) can be specified explicitly. The default
name for log files (generated by SQL Server) appends a suffix to the specified
database name (database-name>), thus if we don't do that, we can have 123
characters in the database name.
It must adhere to the naming guidelines for SQL Server IDs and can be
alphanumeric. To view the naming guidelines for identifiers in SQL Server,
click here.
A single SQL Server instance may support up to 32767 databases at once.
2 ALTER
DATABASE
Using the ALTER DATABASE command, we can modify the settings
of a constructed database. For instance, use the syntax listed below to change
the name of a data or log file.
Syntax: ALTER
DATABASE <database-name> MODIFY FILE (NAME = <old file name>,
NEWNAME = <new file name>)
USE DummyDatabase
ALTER
DATABASE
DummyDatabase MODIFY
FILE (NAME
=
'DummyDatabase_Data', NEWNAME = 'DummyDatabase_Data_Test')
GO
Use the command below to rename the database from
DummyDatabase to DummyDatabase Test;
USE master;
ALTER
DATABASE
DummyDatabase
Modify Name = DummyDatabase_Test;
GO
3 DROP
DATABASE
Use the syntax below to permanently remove a database from
the server;
Syntax: DROP
DATABASE <database-name>
The command to delete database "DummyDatabase" is
listed below.
DROP
Database
DummyDatabase;