Training SQL Day 1

SQL (Structure Query Language)

“SQL is a standard language for accessing and manipulating database”

 

Database Hierarchy

Training Overview

  • Accessing SQL Server Database Engine with SQL Server Management Studio
  • Creating New Database
  • Backup Database
  • Delete Database
  • Restore Database

 

Accessing SQL Server Database Engine with SQL Server Management Studio

SQL Database Engine are running with instance by default instance “MSSQLSERVER” check the services are running on your computer by check “service.msc”, find “SQL Server (instance name)” make sure the service are running.

 

After SQL Server Services are start, now try access your Database engine with SSMS (SQL Server Management Studio), try connect with your local server database engine with type “.” Or “localhost” with SQL Server Authentication user sa

Now we can access SQL Server Database engine like image below

Creating New Database

Create new database from SSMS, on object explorer left click on “Database” section folder and select New Database

Name the Database name, for example TestDB and OK

Refresh the SSMS Object Explorer, and now you can see the new database created

Or you can created new database by using query with this query


Refresh again the object explorer, and now you can see the new database was created

 

Backup Database

How to backup database using SSMS by left click database from object explorer select “Task” and select “Back Up…”

Now select database Backup type, and database Destination and select Ok

And now check the destination folder from backup files you can see backup files .bak

You can using script for backup database

 

 

TO DISK is the destination files and destination folder

 

Delete Database

How to delete database, first left click database which want to be deleted, select delete

Check the “close existing connections”, if you want delete the database which someone still connected the databases, and select ok

You can using script for delete database

 

 

Restoring Database

Restore database, on object explorer left click on “Database” section folder and select “Restore Database…”


Choose Restore Database from device.


Add File Database backup files for example “TestDB.bak”

Select Ok when the database ready to restore.

Database TestDB was successfully restored

Leave a Reply

Your email address will not be published. Required fields are marked *