Getting Started With SQL Server 2022

Introduction

In this article, I am going to explain how to connect SQL Server from the SQL Server Management Studio. After installing SQL Server 2022 and executing a query, and talking about what’s new in SQL Server 2022, the latest version of SQL Server is SQL Server 2022.

Prerequisites

  1. SQL Server 2022
  2. SQL Server Management Studio (SSMS). If you want to learn more about how to install SSMS, please refer to this article How To Install SQL Server Management Studio 2022.

What are the new features in SQL Server 2022?

  • Analytics
  • Availability
  • Security
  • Performance
  • Query Store and intelligent query processing
  • Management
  • Platform
  • Language
  • Tools
  • SQL Machine Learning Services
  • Query Store improvements
  • SQL Server Service is set to Automatic(Delayed Start) start mode
  • SQL Server Analysis Services
  • SQL Server Reporting Services

To get more details about what’s new in SQL Server 2022 Click here.

Connect To SQL Server Using SQL Server Management Studio 2022 (SSMS)

To connect to SQL Server 2022 using the Microsoft SQL Server Management Studio 2022, use the below steps.

Step 1. First, install SQL Server 2022 in your system. To understand the installation process for SQL Server 2022, refer to the instructions provided in this article How To Install SQL Server 2022.

Step 2. Go to all programs in your systems, we can see two folders, one is Microsoft SQL Server 2022 and another one is Microsoft SQL Server Tool 2019. Under Microsoft SQL Server Tools 19 you can see the Microsoft SQL Server Management Studio 19.

Step 3. Double-click on SQL Server Management Studio 19 and it will open looks like the below screenshot. The first opening will take a few minutes.

After opening SQL Server Management Studio 2019, we can see it looks like the below screenshot.

Step 4. Now connect to the server and use the SQL Server Management Studio 2019. Click the Connect button to connect the SQL Server.

Step 5. If the connection is established successfully, then you will see the Object Explorer panel,

Execute a query

Now click on New Query, to open your new query window.

New query window.

Now, first, we will create a Database and a table.

Creating Database and One Table

Step 1. Create a Database

Open your SQL Server and use the following script to create the “Chittadb” Database.

CREATE DATABASE Chittadb;

Now, select the script query then press F5 or click on Execute button to execute the above script.

You should see a message, “Command(s) completed successfully.” This means your new database is created.

We can check now if the database is created or not. Refresh the database and check.

Our database is created.

Step 2. Create a table

Open your SQL Server and use the following script to create table “tbl_Employees”.

CREATE TABLE tbl_Employees
(
    Id INT PRIMARY KEY NOT NULL IDENTITY(1,1),
    FirstName VARCHAR(50),
    LastName VARCHAR(20),
    Location VARCHAR(20),
    Gender VARCHAR(50),
    Salary INT
)

Execute the above query to create “tbl_Employees “.

You should see a message, “Command(s) completed successfully” with completion time.

Now, data is inserted into the table.

INSERT INTO tbl_Employees VALUES ('Chittaranjan', 'Swain', 'Odisha', 'Male', 80000);
INSERT INTO tbl_Employees VALUES ('Chandin', 'Swain', 'Pune', 'Female', 76000);
INSERT INTO tbl_Employees VALUES ('Mitu', 'Pradhan', 'Delhi', 'Male', 55000);
INSERT INTO tbl_Employees VALUES ('Jeni', 'Swain', 'Chennai', 'Female', 76000);
INSERT INTO tbl_Employees VALUES ('Adyashree', 'Swain', 'UK', 'Female', 49000);
INSERT INTO tbl_Employees VALUES ('Ram', 'Kumar', 'US', 'Male', 39000);
INSERT INTO tbl_Employees VALUES ('Jitendra', 'Gouad', 'Hyderabad', 'Male', 35000);
INSERT INTO tbl_Employees VALUES ('Dibas', 'Hembram', 'Bangalore', 'Male', 55000);

Execute the above query, and you should see a message, “(1 row affected)” which means data was inserted successfully.

Now retrieve all data from the “tbl_Employees” table. Execute the below query and get the data.

SELECT * FROM tbl_Employees

Output

Conclusion

In this article, we explained how to connect SQL Server and execute a query from the SQL Server Management Studio 2022 (SSMS) and how to create a database and a table.


Similar Articles