The Azure CREATE TABLE Statement. The CREATE TABLE statement is used to create a new table in a databaseā
Syntax : -
-- Create a new table called '[TableName]' in schema '[dbo]'
-- Drop the table if it already exists
IF OBJECT_ID('[dbo].[TableName]', 'U') IS NOT NULL
DROP TABLE [dbo].[TableName]
GO
-- Create the table in the specified schema
CREATE TABLE [dbo].[TableName]
(
[Id] INT NOT NULL PRIMARY KEY, -- Primary Key column
[ColumnName2] NVARCHAR(50) NOT NULL,
[ColumnName3] NVARCHAR(50) NOT NULL
-- Specify more columns here
);
GO
Example :-
-- Create a new table called '[Sample]' in schema '[dbo]'
-- Drop the table if it already exists
IF OBJECT_ID('[dbo].[Sample]', 'U') IS NOT NULL
DROP TABLE [dbo].[Sample]
GO
-- Create the table in the specified schema
CREATE TABLE [dbo].[Sample]
(
[Id] INT NOT NULL PRIMARY KEY, -- Primary Key column
[ColumnName2] NVARCHAR(50) NOT NULL,
[ColumnName3] NVARCHAR(50) NOT NULL
-- Specify more columns here
);
GO
Run the Codes. After That You should Insert the Records. Right Click on Table that You Created. Select Edit Data Then Insert Records. After Inserting Records . Click on ” Run ” .