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.
Download AdventureWorksLT2019.bak as shown below.
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“
2. Select “Device” and click three dots as shown below
3. Click “Add“.
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.
5. Click OK.
6. Click one more time “OK” to restore the sample database.
7. The sample database has been restored.
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.
RESTORE DATABASE [AdventureWorks2019]
FROM DISK = N’C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Backup\AdventureWorks2019.bak’
WITH FILE = 1, NOUNLOAD, STATS = 5
Follow our article below on how to install SQL Server Express 2019 Edition.
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.