You've installed SQL Server. You've installed Management Studio (and presumably Azure Data Studio) and now you're ready to learn SQL!
But to learn about databases you're going to need some, well databases and whilst creating your own from scratch is a great exercise eventually you'll need something with some data to play around with!
Fortunately Microsoft provide a couple of sample databases you can download and use; namely AdventureWorks which was released way back in SQL Server 2005 and the newer WideWorldImporters (SQL Server 2016) and for both we can download backups of the databases directly from the samples page or use the GitHub SQL Server samples repository.
AdventureWorks Sample Database
AdventureWorks has a couple of different flavours to choose from; OLTP (Online Transaction Processing) which is the "normal" database shall we say. DW for Data Warehousing workloads which has various Dimension and Fact tables and LT which is a lightweight version of the OLTP database (22Mb for the light version compared to 264Mb). Unless you're specifically learning about Data Warehousing (or your really, really short on disk space) then the OLTP version of the database is the best place to start.
You can also download the database for previous versions of SQL Server going back to 2008 R2 although the lightweight version isn't available that far back. If you're not sure what version you're on then running the T-SQL statement SELECT @@VERSION will return that information for you.
Under Restore to SQL Server the samples page contains instructions of how to restore your downloaded sample database via the UI in Management Studio, via a T-SQL command or by using Azure Data Studio. There's also instructions on how to deploy the AdventureWorks sample database to Azure SQL Database.
WideWorldImporters Sample Database
Similarly to AdventureWorks the WideWorldImporters sample databases comes in an OLTP and Data Warehouse (OLAP) version with the exception of the lightweight version. There are also bacpac downloads available for use in the Standard and Premium tiers of Azure SQL Database.
For restoring the database the big difference is that WideWorldImporters is only available for SQL Server versions from 2016 (and above) so you won't be able to restore to older versions. It's also bigger too and takes up roughly 3.5Gb of disk space compared to AdventureWorks (OLTP) 264Mb. If you want to try restoring WideWorldImporters to an Azure SQL Managed Instance you can follow this link.
Which one should I use?
In short, both. There's a lot of content out there for learning SQL Server and you'll often find tutorials using one or the other sample database and although WideWorldImporters is newer most content in my experience are using the AdventureWorks database.
What about something a bit meatier?
Although they're great sample databases to use for learning I often see posts looking for more larger databases which are a bit more "real-world" (mainly because databases tend to be much bigger in real life). AdventureWorks does have a slightly larger version available (direct link to backup file) for SQL Server 2016 or above and there are scripts out there to create newer and larger tables too such as this one from Jonathan Kehayias at SQLSkills.
But it's still a sample database and for something much more realistic Stack Overflow regularly export their data and thankfully Brent Ozar has made that data available in SQL Server format and you can download 10Gb, 50Gb or 180Gb sized databases from here (you'll need a BitTorrent client for the larger sized database).
No comments:
Post a Comment