Register to Better Coder! It's free.
Enjoy the premium features and succeed at every job interview.

How do you create a table in Microsoft SQL Server database?

Experience Level: Junior
Tags: DatabasesQuality Assurance (QA)

Answer

There are two basic options:

Using SSMS designer

  • Connect to the SQL Server instance
  • Go to the Database and expand its node in Object Explorer
  • Right click the node Tables and select New-Table
  • Define the columns and their data types
  • Click Save

Writing and executing SQL script using SSMS query window

  • Connect to the SQL Server instance
  • Go to the Database and expand its node in Object Explorer
  • Click the New Query to open the query window
  • Enter the SQL script for creating the table and execute it
Query
CREATE TABLE People (
	Id int,
	FirstName nvarchar(20),
	LastName nvarchar(20)
)

Comments

No Comments Yet.
Be the first to tell us what you think.
MS SQL Server for Testers
MS SQL Server for Testers

Are you learning Databases ? Try our test we designed to help you progress faster.

Test yourself