Introduction
Northwind database is a sample DB, which is used in numerous tutorials, and helps students to learn about databases and other programming subjects. Some of the subjects that students can learn through the Northwind database are given below.
- How the data is stored in a Relational database.
- Executing queries like SELECT, UPDATE, DELETE, ALTER, etc.
- How to use foreign keys and primary keys in the tables.
- Understanding the database structure and data normalization.
The students can even use the Northwind database to do programming languages like PHP, jQuery, ASP, C++, C#, and more.
Taking into account the usefulness of the Northwind database, I decided to write a tutorial that helps the students restore it in their SQL Server. After restoring it, they can use this database for learning purposes.
Note. This Restoring procedure is just a one-minute job.
Requirements
You should have SQL Server installed on your computer. I am using SQL Server 2012 Edition here. The restoring database steps are the same for other versions of SQL Server, too.
The procedure to restore the Northwind database in SQL Server is given below.
Step 1. The first step is to download the Northwind database backup file (.bak) from GitHub. (I have also attached the Northwind Backup file in this tutorial).
This backup file contains a zip file (.zip). You need to extract the backup file (Northwind. bak) from the zip file.
You can also extract it to any other location on your PC. In this tutorial, I extracted it from the “ E” drive. This makes it easy for me to remember the location.
Step 2. Open SQL Server Management Studio (SSMS). If you don’t have it - download it from the Microsoft Website.
SQL Server Management Studio (SSMS) helps in configuring, managing & developing SQL Server through rich sets of graphical tools.
Once you open SSMS, you will see a Window that asks to connect to the Server. In this Window, put the settings given below
- "Database Engine" for "Server type".
- "localhost” for “Server name".
- "Windows Authentication" for "Authentication".
Now, click the Connect button.
SSMS will connect and open Object Explorer.
Step 3. Object Explorer shows the nodes like databases, security, Server objects, replication, etc. Clicking the Plus sign at the front of these nodes will open them.
Right-click the Databases node and select the Restore Database option.
The Restore Database Window opens up. In this Window, for the “ Source” option, select “ Device” and then click the ” button, which is next to it.
The “Select backup devices” Window will open now. Click the Add button.
The “ Locate Backup File” Window opens up, where you have to go to the folder where the “ Northwind. bak” the file was extracted and select it.
I extracted it to “ E” drive, so I moved it to E drive, where I easily located the backup file.
Now, click the OK button to close the Locate Backup File Window.
You will see the Select backup devices Window now contains the Northwind. bak file.
Click the OK button here too. This will close it, and you will reach the Restore Database Window. Now, the Restore Database Window contains the Northwind. bak and is ready to restore it.
Finally, click the OK button.
The restoration process will start, and after a few seconds, you will get the success message, which says, “ Database ‘ NORTHWND” restored successfully.”
The Northwind database is ready now.
Northwind database is now available in your SQL Server for learning and doing programming work.
To see the Northwind database in your SQL Server, click the “ Refresh” button, followed by clicking the + sign in front of the databases node.
Not only the backup of the Northwind database, if you have a backup file of any other database, then you can use this tutorial to restore it in your SQL Server. The steps are the same.
Conclusion
This concludes this tutorial, and it’s time to learn new database concepts. Have fun.
Check my latest article on C# Corner - Delete records from GridView without Page Reload using jQuery