sample_database

Introduction

In this blog post, we will learn how to download and restore a sample database in Microsoft SQL Server Express 2019.

Microsoft has developed several types of database workloads, such as OLTP for online transaction processing workloads, Data Warehouse (DW) for data warehousing workloads, and Lightweight (LT). It is the lightweight and trimmed-down version of the OLTP sample database.

Sometimes we need this sample database for testing or learning purposes. We can download, restore, and play around with this database to achieve our task.

Download and Restore

Visit the below link to download the sample database.

https://docs.microsoft.com/en-us/sql/samples/adventureworks-install-configure?view=sql-server-ver15&tabs=ssms

Download AdventureWorksLT2019.bak as shown below.

How to Restore Sample Database in SQL Server

Restore Sample Database using SQL Server Management Studio (SSMS)

1. After download the AdventureWorksLT2019.bak database, open SSMS right-click database and select “Restore Database

How to Restore Sample Database in SQL Server

2. Select “Device” and click three dots as shown below

How to Restore Sample Database in SQL Server

3. Click “Add“.

How to Restore Sample Database in SQL Server

4. Select AdventureWorksLT2019.bak file and click “OK.” We copied the downloaded file to the following location C:\Program Files\Microsoft SQL Server\MSSQL15.SQLEXPRESS\MSSQL\Backup. You can browse to the download folder where you downloaded the sample database, Click OK.

How to Restore Sample Database in SQL Server

5. Click OK.

How to Restore Sample Database in SQL Server

6. Click one more time “OK” to restore the sample database.

Click-OK-to-restore

7. The sample database has been restored.

restored-successfully

Restore Sample Database using Transact-SQL (T-SQL)

You can also restore the sample database AdventureWorksLT2019.bak by using Transact-SQL (T-SQL).

T-SQL stands for Transact Structure Query Language, which is a Microsoft product and is an extension of the SQL Language. It is used for creating applications and business logic.

Run the following command.

USE [master]
RESTORE DATABASE [AdventureWorks2019]
FROM DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup\AdventureWorks2019.bak’
WITH FILE = 1, NOUNLOAD, STATS = 5
GO

Follow our article below on how to install SQL Server Express 2019 Edition.

https://easytechhub.com/how-to-install-sql-server-express-2019/

Conclusion

In this blog post, we learned how to download and restore sample databases by using SSMS and T-SQL. Sample databases are helpful for testing and learning purposes.

Spread the love

By Feroz Khan

Feroz Khan works as a system administrator with more than 12 years of experience in information technology. He would like to share the knowledge with others that he has gained during his working experience.

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x