6 min read · Feb 26, 2023

SQL Server is a relational database management system (RDBMS) developed by Microsoft Corporation. It is a widely used tool for storing, managing, and retrieving data from relational databases. SQL Server is used by businesses of all sizes to manage large amounts of data, ranging from small-scale databases to enterprise-level data warehouses.

In this article, we will cover the basics of SQL Server and how to get started with it.

Installation and Setup

The first step in using SQL Server is to install and set it up on your computer. There are several editions of SQL Server available, including the Developer, Express, and Standard editions. The Developer edition is a free version of SQL Server that includes all the features of the Enterprise edition, but it can only be used for development and testing purposes. The Express edition is a free, lightweight version of SQL Server that is suitable for small-scale databases. The Standard edition is a paid version of SQL Server that includes advanced features such as high availability and scalability.

To install SQL Server Express edition, you can download the installation file from the Microsoft website (scroll to bottom right) and follow the installation wizard. Choose “Basic Setup”

After the installation of the SQL Server Express edition is complete, you will need to download the SQL Server Management Studio (SSMS), which is a graphical user interface (GUI) tool that allows you to manage SQL Server databases. SSMS if free to use and can be found on the Microsoft website as well.

Import a Sample Database from GitHub

Importing sample SQL Server databases from GitHub into SSMS is a great way to practice working with databases and SQL skills. Many sample databases are available on GitHub, and most of them come in the form of script files. In this article, we will show you how to import sample SQL Server databases in SSMS from GitHub.

Here are the steps involved to import a Sample Database from a Script File on GitHub

  1. Navigate to the GitHub repository: First, navigate to the GitHub repository that contains the sample database script file. You can search for sample databases on GitHub using keywords such as “SQL Server sample database” or “AdventureWorks database”.
  2. Download the script file: Once you have found the repository that contains the script file, click on the script file to open it. Click on the Raw button to view the script file in its raw format. Right-click on the page and select Save As to save the script file to your local computer.
  3. Open the script file in SSMS: Open SSMS and connect to your SQL Server. Open the script file in the Query Editor window by clicking on File -> Open -> File.
  4. Execute the script: Execute the script by clicking on the Execute button in the toolbar or pressing F5. The script may take several minutes to execute depending on the size of the database.
  5. Access the database: Once the script has finished executing, you can access the database by expanding the Databases folder in the Object Explorer window and selecting the newly created database.

Importing the Northwind Database in SSMS

For my courses and video tutorials, I use the Northwind database. The Northwind database is a popular sample database that is used for learning SQL and practicing database management. It can be downloaded from GitHub and imported into SQL Server Management Studio (SSMS) to explore the data and practice SQL queries. Here are the steps to import Northwind into SSMS from GitHub:

  1. Download the Northwind database files from GitHub: Go to the GitHub repository for the Northwind database (https://github.com/Microsoft/sql-server-samples/tree/master/samples/databases/northwind-pubs) and download the files.
  2. Save instnwnd.sql on your computer
  3. In SSMS, open the script file in the Query Editor window by clicking on File -> Open -> File.
  4. Execute the script: Execute the script by clicking on the Execute button in the toolbar or pressing F5.
  5. Voilà. You’re ready to learn or write SQL.

The Object Explorer Window

The Object Explorer window in SQL Server Management Studio (SSMS) is a powerful tool that allows you to manage SQL Server databases, including performing basic tasks, executing queries, and managing data.

The Object Explorer window is located on the left-hand side of the SSMS application window, by default. If you can’t see it, you can open it by selecting “View” from the menu bar and then clicking “Object Explorer”. Alternatively, you can use the keyboard shortcut “Ctrl + Alt + T” to open the window.

Navigate the Object Explorer window: The Object Explorer window contains a hierarchical view of the SQL Server instance and the databases it hosts, along with other objects such as tables, views, stored procedures, and users. You can expand or collapse these objects by clicking the plus (+) or minus (-) sign next to them. You can also right-click on an object to view its properties or to perform actions such as creating a new object, executing a script, or deleting an object.

Performing Basic Tasks

Using the Object Explorer window in SSMS, you can perform basic tasks such as creating a new database, creating a table, and modifying table properties. To create a new database, right-click on the Databases folder and select “New Database”. In the New Database dialog box, enter a name for the database and specify the location of the data and log files. To create a new table, right-click on the Tables folder and select New Table. In the Table Designer window, you can specify the columns and properties for the table.

To modify table properties, right-click on the table in the Object Explorer window and select Design. In the Table Designer window, you can add, remove, or modify columns, set column properties such as data type and constraints, and add or remove indexes.

Executing Tasks and Queries

Using the Object Explorer window, you can execute tasks and queries on SQL Server databases. To execute a task, right-click on the database, table, or other object in the Object Explorer window and select the task you want to perform. For example, you can execute tasks such as backing up a database, restoring a database, and creating a new user.

To execute a query, open the SQL Server Query Editor by clicking on the New Query button in the toolbar or pressing Ctrl+N. In the Query Editor window, you can write SQL queries and execute them by clicking on the Execute button in the toolbar or pressing F5. You can also use the Object Explorer window to execute queries by right-clicking on the database or table and selecting New Query.

Managing Data

Using the Object Explorer window, you can manage data in SQL Server databases, including inserting, updating, and deleting data from tables. To insert data into a table, right-click on the table in the Object Explorer window and select Edit Top 200 Rows. In the Edit Data window, you can enter data for the columns in the table.

To update or delete data from a table, you can write SQL queries in the SQL Server Query Editor. For example, to update data in a table, you can write a query like this:

UPDATE Customers SET LastName = 'Doe' WHERE FirstName = 'John'

To delete data from a table, you can write a query like this:

DELETE FROM Customers WHERE LastName = ‘Doe’

Conclusion

Installing SQL Server is a straightforward process that involves selecting the Express edition. Once installed, SQL Server can be managed using SQL Server Management Studio (SSMS), which provides a graphical user interface for performing tasks like creating databases, tables, and stored procedures.

The Object Explorer window in SQL Server Management Studio (SSMS) is a powerful tool that allows you to perform basic tasks, execute queries, and manage data in SQL Server databases. By using the Object Explorer window, you can efficiently manage your SQL Server databases and perform a wide range of tasks and queries.

Overall, SQL Server is a powerful and widely used database management system, and learning to work with it can be a valuable skill for data professionals. With practice and experience, beginners can become proficient at using SQL Server to manage data and support their organization’s data management needs.


Leave a Reply

Your email address will not be published. Required fields are marked *