How to install SQL server on your computer. Build and query tables here!

How to install SQL server on your computer. Build and query tables here!

Installing SQL Server traditionally requires time and effort, but with the advent of containerization and powerful tools like Docker and Azure Data Studio, the process has become significantly simpler. I will walk you through the step-by-step process of installing SQL Server using a Docker image and managing it with Azure Data Studio, ensuring a seamless experience for database administrators, developers or business/data analysts.

Prerequisites

  1. Docker installed on your machine: Docker allows you to run applications in containers, providing an isolated environment for easy deployment and management.

  2. Azure Data Studio: Azure Data Studio is a cross-platform database management tool that offers a rich set of features for working with SQL Server and other database systems.

Installing Docker

Use this official docker link to download docker for your supporting operating system.

https://www.docker.com

To run the image on docker type the below command in terminal.This will create an image on your docker file which is required to build a connection using azure data studio. You can customise password.

docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=Dudedudedude000" -e "MSSQL_PID=Developer" -e "MSSQL_USER=SA" -p 1433:1433 -d --name=sql mcr.microsoft.com/azure-sql-edge

Once the terminal downloads the necessary files you can verify the image on docker like below

Also make sure the container in sql is showing running status. If the status is exited it could be error with the password and you will end up getting error 40 while setting up azure local host , make sure the password as compliant

Installing Azure Data Studio

After installing docker, next step is to install sql server provider and I am using microsoft azure here. You can install official Azure SQL management studio. It is required to create a docker id in order to setup azure , sign up using your credentials.

Now its time to install microsoft sql container image , head over to docker on your browser and search for Microsoft Azure sql edge and run the pull command on your terminal.

https://hub.docker.com/_/microsoft-azure-sql-edge

Download azure data studio using this link. for your supporting OS and install it

https://learn.microsoft.com/en-us/sql/azure-data-studio/download-azure-data-studio?view=sql-server-ver16&tabs=redhat-install%2Credhat-uninstall

now head over to azure data studio to create a connection ,

  1. Click on the "New Connection" button on the toolbar or go to the "Connections" tab and click on the "+" icon.

  2. In the "Server name" field, enter localhost.

  3. Choose "SQL Server Authentication" as the authentication type.

  4. Enter sa as the username and the password you set in Step 2.

  5. Click "Connect."

once the connection is established you can create datasets and query the table as below

Once SQL server is installed try and create tables and query them to test for any error.

Happy SQL’ing 😊

Did you find this article valuable?

Support Chandan Ravi by becoming a sponsor. Any amount is appreciated!