How to create table in Azure SQL database

How to create table in Azure SQL database

In this Azure SQL article, we will discuss a step-by-step guide to create a table in the Azure SQL database quickly.

How to create table in Azure SQL database

Before discussing the actual functionality, let’s discuss the prerequisites needed here.

Prerequisites

I am assuming that you are ready with all the prerequisites needed here. Let’s start with the actual functionality. Follow the below steps

  1. The First and most important step is to connect your Azure SQL database from your SQL Server Management Studio.
  2. Once connected to your Azure SQL Database, Click on the + button to expand the Databases node.
how to create a table in azure sql

3. Right-click the Database name –> Click on the New Query option.

azure sql create table

4. On the New Query window, copy and paste the below query and change the table name, column name, etc, based on your need.

CREATE TABLE TsInfo
(
    EmpId INT IDENTITY PRIMARY KEY,
    EmpName NVARCHAR(128) NOT NULL,
    Email NVARCHAR(256)
)

Then, click the Execute button or press F5 to execute the SQL query.

create table in azure sql database

Now, the query is executed successfully without any issues.

create table azure sql

Now, To cross-check the table that was created successfully, Expand the Databases node and then expand the Tables node. You can able to see the table is present here.

how to create azure sql table

Note: If you cannot see the table here, right-click on the Tables node and click the Refresh option. Expand the Tables node again, and this time, you should able to see the Azure SQL table that you have created.

azure sql database create table

Example 2: Let’s create a Student table.

1. On the Query window, write the query below.

CREATE TABLE Student
(
    StudentId INT IDENTITY PRIMARY KEY,
    FirstName NVARCHAR(128) NOT NULL,
    LastName NVARCHAR(128) NOT NULL,
    DateOfBirth DATE NOT NULL
)

2. After writing the Query, click on the Execute button, as shown below.

create a table in azure sql database

3. Now, you can see that it is showing Commands completed successfully.

azure sql create table example

4. To verify if the table is created, you can expand the Database node –> Expand the Tables –> You can see the dbo. Student table has been created successfully without any issues.

how to create tables in azure sql database

This is how to create tables In the SQL Azure database.

You may also like following the articles below

Wrapping Up

In this article, we discussed the steps to create a table in the Azure SQL database. Thanks for reading this article, and I hope this article will help you !!!