Sample database for sql server
Author: s | 2025-04-23
Microsoft Sql Server Real World Database Samples for SQL 2025 version and up. sql-server sql-server-database microsoft-sql-server sql-database sqlserver sample-database sample-databases microsoft-sqlserver-database sample-data microsoft-sql-server-2025 microsoft-sql-server-2025. Updated ;
SQL SERVER - SQL Server 2025 Samples and Sample Databases
Linux, change the Windows filesystem path to Linux, and then run the following Transact-SQL (T-SQL) command:USE [master];GORESTORE DATABASE [AdventureWorks2022]FROM DISK = '/var/opt/mssql/backup/AdventureWorks2022.bak'WITH MOVE 'AdventureWorks2022' TO '/var/opt/mssql/data/AdventureWorks2022_Data.mdf', MOVE 'AdventureWorks2022_log' TO '/var/opt/mssql/data/AdventureWorks2022_log.ldf', FILE = 1, NOUNLOAD, STATS = 5;GOIf you're not familiar using Azure Data Studio Studio, see connect & query to get started.To restore your database in Azure Data Studio, follow these steps:Download the appropriate .bak file from one of links provided in the download backup files section.Move the .bak file to your SQL Server backup location. This location varies depending on your installation location, instance name, and version of SQL Server. For example, the default location for a default instance of SQL Server 2022 (16.x) is:C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\BackupOpen Azure Data Studio and connect to your SQL Server instance.Right-click on your server and select Manage.Select RestoreOn the General tab, fill in the values listed under Source.Under Restore from, select Backup file.Under Backup file path, select the location you stored the .bak file.This step autopopulates the rest of the fields such as Database, Target database and Restore to.Select Restore to restore your database.Deploy to Azure SQL DatabaseYou have two options to view sample Azure SQL Database data. You can use a sample when you create a new database, or you can deploy a database from SQL Server directly to Azure using SSMS.To get sample data for Azure SQL Managed Instance instead, see restore World Wide Importers to SQL Managed Instance.Deploy new sample databaseWhen you create a new database in Azure SQL Database, you can create a blank database, restore from a backup, or select sample data to populate your new database.Follow these steps to add a sample data to your new database:Connect to your Azure portal.Select Create a resource in the top left of the navigation pane.Select Databases and then select SQL Database.Fill in the requested information to create your database.On the Additional settings tab, choose Sample as the existing data under Data source:Select Create to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.Deploy database from SQL ServerSSMS allows you to deploy a database directly to Azure SQL Database. This method doesn't currently provide data validation so is intended for development and testing and shouldn't be used for production.To deploy a sample database from SQL Server to Azure SQL Database, follow these steps:Connect to your SQL Server in SSMS.If you haven't already done so, restore the sample database to SQL Server.Right-click your restored database in Object Explorer > Tasks > Deploy Database to Microsoft Azure SQL Database....Follow the wizard to connect to Azure SQL Database and deploy your database.Creation scriptsInstead of restoring a database, alternatively, you can use scripts to create the AdventureWorks databases regardless of version.The below scripts can be used to create the entire AdventureWorks database:AdventureWorks OLTP Scripts ZipAdventureWorks DW Scripts ZipAdditional information about using the scripts can be found on GitHub.Related contentDatabase Engine TutorialsQuickstart: Connect and query a SQL Server instance using SQL Server Management Studio (SSMS)Quickstart: Use Azure Data Studio to Microsoft Sql Server Real World Database Samples for SQL 2025 version and up. sql-server sql-server-database microsoft-sql-server sql-database sqlserver sample-database sample-databases microsoft-sqlserver-database sample-data microsoft-sql-server-2025 microsoft-sql-server-2025. Updated ; Database using Transact-SQL (T-SQL). An example to restore AdventureWorks2022 is provided in the following example, but the database name and installation file path can vary depending on your environment.To restore AdventureWorks2022 on Windows, modify values as appropriate to your environment and then run the following Transact-SQL (T-SQL) command:USE [master];GORESTORE DATABASE [AdventureWorks2022]FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup\AdventureWorks2022.bak'WITH FILE = 1, NOUNLOAD, STATS = 5;GOTo restore AdventureWorks2022 on Linux, change the Windows filesystem path to Linux, and then run the following Transact-SQL (T-SQL) command:USE [master];GORESTORE DATABASE [AdventureWorks2022]FROM DISK = '/var/opt/mssql/backup/AdventureWorks2022.bak'WITH MOVE 'AdventureWorks2022' TO '/var/opt/mssql/data/AdventureWorks2022_Data.mdf', MOVE 'AdventureWorks2022_log' TO '/var/opt/mssql/data/AdventureWorks2022_log.ldf', FILE = 1, NOUNLOAD, STATS = 5;GOIf you're not familiar using Azure Data Studio Studio, see connect & query to get started.To restore your database in Azure Data Studio, follow these steps:Download the appropriate .bak file from one of links provided in the download backup files section.Move the .bak file to your SQL Server backup location. This location varies depending on your installation location, instance name, and version of SQL Server. For example, the default location for a default instance of SQL Server 2022 (16.x) is:C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\BackupOpen Azure Data Studio and connect to your SQL Server instance.Right-click on your server and select Manage.Select RestoreOn the General tab, fill in the values listed under Source.Under Restore from, select Backup file.Under Backup file path, select the location you stored the .bak file.This step autopopulates the rest of the fields such as Database, Target database and Restore to.Select Restore to restore your database.Deploy to Azure SQL DatabaseYou have two options to view sample Azure SQL Database data. You can use a sample when you create a new database, or you can deploy a database from SQL Server directly to Azure using SSMS.To get sample data for Azure SQL Managed Instance instead, see restore World Wide Importers to SQL Managed Instance.Deploy new sample databaseWhen you create a new database in Azure SQL Database, you can create a blank database, restore from a backup, or select sample data to populate your new database.Follow these steps to add a sample data to your new database:Connect to your Azure portal.Select Create a resource in the top left of the navigation pane.Select Databases and then select SQL Database.Fill in the requested information to create your database.On the Additional settings tab, choose Sample as the existing data under Data source:Select Create to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.Deploy database from SQL ServerSSMS allows you to deploy a database directly to Azure SQL Database. This method doesn't currently provide data validation so is intended for development and testing and shouldn't be used for production.To deploy a sample database from SQL Server to AzureComments
Linux, change the Windows filesystem path to Linux, and then run the following Transact-SQL (T-SQL) command:USE [master];GORESTORE DATABASE [AdventureWorks2022]FROM DISK = '/var/opt/mssql/backup/AdventureWorks2022.bak'WITH MOVE 'AdventureWorks2022' TO '/var/opt/mssql/data/AdventureWorks2022_Data.mdf', MOVE 'AdventureWorks2022_log' TO '/var/opt/mssql/data/AdventureWorks2022_log.ldf', FILE = 1, NOUNLOAD, STATS = 5;GOIf you're not familiar using Azure Data Studio Studio, see connect & query to get started.To restore your database in Azure Data Studio, follow these steps:Download the appropriate .bak file from one of links provided in the download backup files section.Move the .bak file to your SQL Server backup location. This location varies depending on your installation location, instance name, and version of SQL Server. For example, the default location for a default instance of SQL Server 2022 (16.x) is:C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\BackupOpen Azure Data Studio and connect to your SQL Server instance.Right-click on your server and select Manage.Select RestoreOn the General tab, fill in the values listed under Source.Under Restore from, select Backup file.Under Backup file path, select the location you stored the .bak file.This step autopopulates the rest of the fields such as Database, Target database and Restore to.Select Restore to restore your database.Deploy to Azure SQL DatabaseYou have two options to view sample Azure SQL Database data. You can use a sample when you create a new database, or you can deploy a database from SQL Server directly to Azure using SSMS.To get sample data for Azure SQL Managed Instance instead, see restore World Wide Importers to SQL Managed Instance.Deploy new sample databaseWhen you create a new database in Azure SQL Database, you can create a blank database, restore from a backup, or select sample data to populate your new database.Follow these steps to add a sample data to your new database:Connect to your Azure portal.Select Create a resource in the top left of the navigation pane.Select Databases and then select SQL Database.Fill in the requested information to create your database.On the Additional settings tab, choose Sample as the existing data under Data source:Select Create to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.Deploy database from SQL ServerSSMS allows you to deploy a database directly to Azure SQL Database. This method doesn't currently provide data validation so is intended for development and testing and shouldn't be used for production.To deploy a sample database from SQL Server to Azure SQL Database, follow these steps:Connect to your SQL Server in SSMS.If you haven't already done so, restore the sample database to SQL Server.Right-click your restored database in Object Explorer > Tasks > Deploy Database to Microsoft Azure SQL Database....Follow the wizard to connect to Azure SQL Database and deploy your database.Creation scriptsInstead of restoring a database, alternatively, you can use scripts to create the AdventureWorks databases regardless of version.The below scripts can be used to create the entire AdventureWorks database:AdventureWorks OLTP Scripts ZipAdventureWorks DW Scripts ZipAdditional information about using the scripts can be found on GitHub.Related contentDatabase Engine TutorialsQuickstart: Connect and query a SQL Server instance using SQL Server Management Studio (SSMS)Quickstart: Use Azure Data Studio to
2025-03-28Database using Transact-SQL (T-SQL). An example to restore AdventureWorks2022 is provided in the following example, but the database name and installation file path can vary depending on your environment.To restore AdventureWorks2022 on Windows, modify values as appropriate to your environment and then run the following Transact-SQL (T-SQL) command:USE [master];GORESTORE DATABASE [AdventureWorks2022]FROM DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\Backup\AdventureWorks2022.bak'WITH FILE = 1, NOUNLOAD, STATS = 5;GOTo restore AdventureWorks2022 on Linux, change the Windows filesystem path to Linux, and then run the following Transact-SQL (T-SQL) command:USE [master];GORESTORE DATABASE [AdventureWorks2022]FROM DISK = '/var/opt/mssql/backup/AdventureWorks2022.bak'WITH MOVE 'AdventureWorks2022' TO '/var/opt/mssql/data/AdventureWorks2022_Data.mdf', MOVE 'AdventureWorks2022_log' TO '/var/opt/mssql/data/AdventureWorks2022_log.ldf', FILE = 1, NOUNLOAD, STATS = 5;GOIf you're not familiar using Azure Data Studio Studio, see connect & query to get started.To restore your database in Azure Data Studio, follow these steps:Download the appropriate .bak file from one of links provided in the download backup files section.Move the .bak file to your SQL Server backup location. This location varies depending on your installation location, instance name, and version of SQL Server. For example, the default location for a default instance of SQL Server 2022 (16.x) is:C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\BackupOpen Azure Data Studio and connect to your SQL Server instance.Right-click on your server and select Manage.Select RestoreOn the General tab, fill in the values listed under Source.Under Restore from, select Backup file.Under Backup file path, select the location you stored the .bak file.This step autopopulates the rest of the fields such as Database, Target database and Restore to.Select Restore to restore your database.Deploy to Azure SQL DatabaseYou have two options to view sample Azure SQL Database data. You can use a sample when you create a new database, or you can deploy a database from SQL Server directly to Azure using SSMS.To get sample data for Azure SQL Managed Instance instead, see restore World Wide Importers to SQL Managed Instance.Deploy new sample databaseWhen you create a new database in Azure SQL Database, you can create a blank database, restore from a backup, or select sample data to populate your new database.Follow these steps to add a sample data to your new database:Connect to your Azure portal.Select Create a resource in the top left of the navigation pane.Select Databases and then select SQL Database.Fill in the requested information to create your database.On the Additional settings tab, choose Sample as the existing data under Data source:Select Create to create your new SQL Database, which is the restored copy of the AdventureWorksLT database.Deploy database from SQL ServerSSMS allows you to deploy a database directly to Azure SQL Database. This method doesn't currently provide data validation so is intended for development and testing and shouldn't be used for production.To deploy a sample database from SQL Server to Azure
2025-04-23SQL Server release tags and install a previous version, use:sqlcmd create mssql get-tagssqlcmd create mssql --tag 2019-latestCreate SQL Server with AdventureWorks Sample DatabaseTo create a SQL Server container and attach the AdventureWorks sample database, use:sqlcmd create mssql --using SQL Server with Custom Database NameTo create a SQL Server container and attach the AdventureWorks sample database with a custom name, use:sqlcmd create mssql --using SQL Server with Empty User DatabaseTo create a SQL Server container with an empty user database, use:sqlcmd create mssql --user-database db1Install with Full LoggingTo create a SQL Server container with full logging enabled, use:sqlcmd create mssql --verbosity 4ConclusionGo-SQLcmd offers a practical and efficient way to manage SQL Server environments. By using this tool, developers and database administrators can quickly spin up SQL Server instances in a lightweight manner. The ability to create containers, restore databases from backups, and integrate seamlessly with Azure Data Studio makes Go-SQLcmd a useful addition to your toolkit.
2025-04-08Pāriet uz galveno saturu Šī pārlūkprogramma vairs netiek atbalstīta. Jauniniet uz Microsoft Edge, lai izmantotu jaunāko līdzekļu, drošības atjauninājumu un tehniskā atbalsta sniegtās priekšrocības. AdventureWorks sample databases Raksts09/04/2024 Šajā rakstā -->Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)This article provides direct links to download AdventureWorks sample databases, and instructions for restoring them to SQL Server, Azure SQL Database, and Azure SQL Managed Instance.For more information about samples, see the Samples GitHub repository.PrerequisitesSQL Server or Azure SQL DatabaseSQL Server Management Studio (SSMS) or Azure Data StudioDownload backup filesUse these links to download the appropriate sample database for your scenario.OLTP data is for most typical online transaction processing workloads.Data Warehouse (DW) data is for data warehousing workloads.Lightweight (LT) data is a lightweight and pared down version of the OLTP sample.If you're not sure what you need, start with the OLTP version that matches your SQL Server version.OLTPData WarehouseLightweightAdventureWorks2022.bakAdventureWorksDW2022.bakAdventureWorksLT2022.bakAdventureWorks2019.bakAdventureWorksDW2019.bakAdventureWorksLT2019.bakAdventureWorks2017.bakAdventureWorksDW2017.bakAdventureWorksLT2017.bakAdventureWorks2016.bakAdventureWorksDW2016.bakAdventureWorksLT2016.bakAdventureWorks2016_EXT.bakAdventureWorksDW2016_EXT.bakN/AAdventureWorks2014.bakAdventureWorksDW2014.bakAdventureWorksLT2014.bakAdventureWorks2012.bakAdventureWorksDW2012.bakAdventureWorksLT2012.bakAdventureWorks2008R2.bakAdventureWorksDW2008R2.bakN/AAdditional files can be found directly on GitHub:SQL Server 2014 - 2022SQL Server 2012SQL Server 2008 and 2008R2Restore to SQL ServerYou can use the .bak file to restore your sample database to your SQL Server instance. You can do so using the RESTORE Statements command, or using the graphical interface (GUI) in SQL Server Management Studio (SSMS) or Azure Data Studio.SQL Server Management Studio (SSMS)Transact-SQL (T-SQL)Azure Data StudioIf you're not familiar using SQL Server Management Studio (SSMS), you can see connect & query to get started.To restore your database in SSMS, follow these steps:Download the appropriate .bak file from one of links provided in the download backup files section.Move the .bak file to your SQL Server backup location. This location varies depending on your installation location, instance name, and version of SQL Server. For example, the default location for a default instance of SQL Server 2022 (16.x) is:C:\Program Files\Microsoft SQL Server\MSSQL16.MSSQLSERVER\MSSQL\BackupOpen SSMS and connect to your SQL Server instance.Right-click Databases in Object Explorer > Restore Database... to launch the Restore Database wizard.Select Device and then select the ellipses (...) to choose a device.Select Add and then choose the .bak file you recently moved to the backup location. If you moved your file to this location but you're not able to see it in the wizard, SQL Server or the user signed into SQL Server doesn't have permission to this file in this folder.Select OK to confirm your database backup selection and close the Select backup devices window.Check the Files tab to confirm the Restore as location and file names match your intended location and file names in the Restore Database wizard.Select OK to restore your database.For more information on restoring a SQL Server database, see Restore a database backup using SSMS.You can restore your sample
2025-03-30