SQL Server Tutorials - CREATE, ALTER, DROP database in SQL Server - #2

Publicado em: 19 Março 2024
no canal de: Everyday Be Coding
17
0

SQL Server Tutorials - CREATE, ALTER, DROP database in SQL Server

To create, alter, and drop a SQL Server database, you'll typically use SQL commands within SQL Server Management Studio (SSMS) or another SQL client. Below are the steps for each operation:

1. Creating a Database:
To create a new database in SQL Server, you use the CREATE DATABASE statement. Here's an example:

CREATE DATABASE YourDatabaseName;
Replace YourDatabaseName with the desired name for your database.

2. Altering a Database:
You can alter a database to modify its properties. For instance, you might want to change its collation, set options, or modify file properties. Here's an example of altering the database collation:

ALTER DATABASE YourDatabaseName
COLLATE Latin1_General_CI_AS; -- Change collation to case-insensitive, accent-sensitive
3. Dropping a Database:
Dropping a database permanently removes it and its contents from the SQL Server instance. This operation cannot be undone, so use it with caution.

DROP DATABASE YourDatabaseName;
Example:
Let's put it all together:

Creating a Database:

CREATE DATABASE ExampleDB;
Altering the Database:

For example, changing the database collation:

ALTER DATABASE ExampleDB
COLLATE Latin1_General_CI_AS;
Dropping the Database:

DROP DATABASE ExampleDB;

Make sure to execute these statements in a SQL query window or execute them through a script in SQL Server Management Studio (SSMS) or any other SQL client. Always exercise caution, especially when dropping a database, as it permanently deletes all its data.

Chapter :
00:00 Intro
00:15 Creating a Database
00:40 Altering a Database
01:10 Dropping a Database
01:30 Summery

Thanks
EVERYDAY BE CODING


Nesta página do site você pode assistir ao vídeo on-line SQL Server Tutorials - CREATE, ALTER, DROP database in SQL Server - #2 duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário Everyday Be Coding 19 Março 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 17 vezes e gostou 0 espectadores. Boa visualização!