• About
  • Contact
  • Cookie
  • Disclaimer
  • Privacy Policy
  • Change the purpose of use

Tnhelearning.edu.vn - Various useful general information portal

  • Photo
  • Bio
  • How To
  • Tech

How to Create SQL Server Database

February 1, 2024 by admin Category: How To

You are viewing the article How to Create SQL Server Database  at Tnhelearning.edu.vn you can quickly access the necessary information in the table of contents of the article below.

X

wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 16 people, some of whom are anonymous, have edited and improved the article over time.

This article has been viewed 7,787 times.

The SQL server database is one of the most popular today, in part because it is so easy to create and maintain. With a graphical user interface (GUI) program like SQL Server Management, you no longer have to worry about manipulating the command line. Continue reading Step 1 to create a database and start entering your information in just a few minutes.

Steps

Image titled Create a SQL Server Database Step 1

Image titled Create a SQL Server Database Step 1

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/74/Create-a-SQL-Server-Database-Step-1-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-1-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/7/74/Create-a-SQL-Server- Database-Step-1-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-1-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Install SQL Server Management Studio software. This software is freely available from Microsoft and it allows you to connect to and manage SQL server from a graphical interface instead of having to use the command line.

  • To connect to a remote SQL server, you will need this or other similar software.
  • Mac users can use open source programs like DbVisualizer or SQuirreL SQL. Although the interface may be different, they share the same principles of use. [1] X Research Source
  • You can refer more to learn how to create a database using the command line.
Image titled Create a SQL Server Database Step 2

Image titled Create a SQL Server Database Step 2

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/0/06/Create-a-SQL-Server-Database-Step-2-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-2-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/0/06/Create-a-SQL-Server- Database-Step-2-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-2-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Start SQL Server Management Studio. When you start running the program, you will be asked which server you want to connect to. If a certain server is running and all the necessary permissions to connect to that server are already in place, you can enter the server address and credentials. If you want to create a local database, set the Database Name to . and the authentication type is “Windows Authentication”.

  • Click Connect to continue.
Image titled Create a SQL Server Database Step 3

Image titled Create a SQL Server Database Step 3

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/8/8d/Create-a-SQL-Server-Database-Step-3-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-3-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/8/8d/Create-a-SQL-Server- Database-Step-3-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-3-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Locate the Databases folder. Once a connection to the local or remote server has been initiated, an Object Explorer window will be opened on the left side of the screen. At the top of the Object Explorer directory tree is the connected server. If the tree isn’t open, click the “+” icon next to it. Locate the Databases folder. [2] X Research Source
Image titled Create a SQL Server Database Step 4

READ More:   How to Uninstall Google Chrome

Image titled Create a SQL Server Database Step 4

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/73/Create-a-SQL-Server-Database-Step-4-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-4-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/7/73/Create-a-SQL-Server- Database-Step-4-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-4-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Create a new database. Right click on the Databases folder and select “New Database…”. A new window will appear, allowing you to configure the database before initialization. You should name the database so that it is easily identifiable. Most users leave the rest at the default settings. [3] X Research Sources

  • When you enter a database name, two additional files are created automatically: the Data file and the Log file. The data file keeps all the data in your database and the log file records every change in that database.
  • Click OK to create the database. The new database will appear in the expanded Databases folder and have a cylinder icon.
Image titled Create a SQL Server Database Step 5

Image titled Create a SQL Server Database Step 5

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/cc/Create-a-SQL-Server-Database-Step-5-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-5-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/c/cc/Create-a-SQL-Server- Database-Step-5-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-5-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Create Table. Databases only store data when you create a structure for that data. The table stores the information entered into the database and to be able to import the data you need to create the table first. Expand the new database in your Databases folder, right-click the Tables folder and select “New Table…”.

  • Windows will open the rest of the screen, helping you work with the new panel.
Image titled Create a SQL Server Database Step 6

Image titled Create a SQL Server Database Step 6

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/72/Create-a-SQL-Server-Database-Step-6-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-6-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/7/72/Create-a-SQL-Server- Database-Step-6-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-6-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Create a Primary Key. You should create a Primary Key in the first column of the table. It will be the ID number or record that allows you to easily access these items again. To create a Primary Key, you need to enter “ID” in the Cpumn Name field, type int in the Data Type field, and uncheck “Allow Nulls”. Click the Key icon in the toolbar to set this column as the Primary Key.

  • Empty values should not be accepted because here you always want the item to have a value of at least “1”. If left blank is allowed, your first entry will be “0”.
  • On the Cpumn Properties window, scroll down to the Identify Specification option. Expand and set “Yes” to “(ls Identity)”. The value of the ID column will automatically increment through each data entry, thereby numbering new entries automatically and efficiently.
READ More:   How to Keep Cut Apples from Darkening
Image titled Create a SQL Server Database Step 7

Image titled Create a SQL Server Database Step 7

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/7/73/Create-a-SQL-Server-Database-Step-7-Version-3.jpg/v4-728px-Create- a-SQL-Server-Database-Step-7-Version-3.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/7/73/Create-a-SQL-Server- Database-Step-7-Version-3.jpg/v4-728px-Create-a-SQL-Server-Database-Step-7-Version-3.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Understand the structure of the table. A table is a collection of fields or columns. Each column represents an aspect of an entry in the database. For example, with a database of company employees, you might have columns “First Name”, “Last Name”, “Address”, and “Telephone Number”.
Image titled Create a SQL Server Database Step 8

Image titled Create a SQL Server Database Step 8

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/c/c6/Create-a-SQL-Server-Database-Step-8-Version-2.jpg/v4-728px-Create- a-SQL-Server-Database-Step-8-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/c/c6/Create-a-SQL-Server- Database-Step-8-Version-2.jpg/v4-728px-Create-a-SQL-Server-Database-Step-8-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Create the rest of the columns. Once you’ve filled in the Primary Key fields, more new fields will appear directly below that field, allowing you to enter the next column. Fill in the fields accordingly and make sure you have selected the correct data type for the information you will enter in that column:

  • nchar( # ) – This is the recommended data type for text, such as names, addresses, etc. The number in parentheses is the maximum number of characters entered for that field. Set limits to ensure that the database size is manageable. Phone numbers should be stored in this format because they will not be used in calculation functions.
  • int – This is the data type for integers and is commonly used for the ID field.
  • decimal( x , y ) – With this data type, the number will be stored as a decimal, and the numbers in parentheses represent the total number of digits and the number of digits in decimal, respectively. For example, with decimal(6,2) , the numbers will be stored as 0000.00 .
Image titled Create a SQL Server Database Step 9

Image titled Create a SQL Server Database Step 9

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/6/6a/Create-a-SQL-Server-Database-Step-9-Version-2.jpg/v4-728px-Create- a-SQL-Server-Database-Step-9-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/6/6a/Create-a-SQL-Server- Database-Step-9-Version-2.jpg/v4-728px-Create-a-SQL-Server-Database-Step-9-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Save the table. Once you’ve created the column, you need to save the table before entering the information. Click the Save icon in the toolbar and type something in the table. You should use a name that represents the contents of the table, especially with large databases, which are made up of many tables.
Image titled Create a SQL Server Database Step 10

Image titled Create a SQL Server Database Step 10

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/9/99/Create-a-SQL-Server-Database-Step-10-Version-2.jpg/v4-728px-Create- a-SQL-Server-Database-Step-10-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/9/99/Create-a-SQL-Server- Database-Step-10-Version-2.jpg/v4-728px-Create-a-SQL-Server-Database-Step-10-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Add data to your table. After saving the table, you can start adding data to it. Let’s expand the Tables folder in the Object Explorer window. If the new board isn’t listed here, right-click the folder and select Refresh. Right click on the table and select “Edit Top 200 Rows”. [4] X Research Sources

  • You can start entering data on the fields displayed in the central window. The ID field will be filled in automatically. So for now, you can ignore it. Please fill in the remaining fields. When you click on the next line, you will see the ID field of the first line populate automatically.
  • Continue this process until you have entered all the information you need.
READ More:   How to dress up a man as a woman
Image titled Create a SQL Server Database Step 11

Image titled Create a SQL Server Database Step 11

{“smallUrl”:”https://www.wikihow.com/images_en/thumb/4/4d/Create-a-SQL-Server-Database-Step-11-Version-2.jpg/v4-728px-Create- a-SQL-Server-Database-Step-11-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/4/4d/Create-a-SQL-Server- Database-Step-11-Version-2.jpg/v4-728px-Create-a-SQL-Server-Database-Step-11-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
Execute the table to save the data. When you’re done entering the information, click the Execute SQL button on the toolbar to save them to the table. SQL Server will run in the background, splitting all the data into the columns you created. This button is empty like a red exclamation point. You can also press Ctrl + R to execute the command.

  • If there is an error, the wrong row will be specified before the table is executed.
  • Image titled Create a SQL Server Database Step 12

    Image titled Create a SQL Server Database Step 12

    {“smallUrl”:”https://www.wikihow.com/images_en/thumb/3/37/Create-a-SQL-Server-Database-Step-12-Version-2.jpg/v4-728px-Create- a-SQL-Server-Database-Step-12-Version-2.jpg”,”bigUrl”:”https://www.wikihow.com/images/thumb/3/37/Create-a-SQL-Server- Database-Step-12-Version-2.jpg/v4-728px-Create-a-SQL-Server-Database-Step-12-Version-2.jpg”,”smallWidth”:460,”smallHeight”:345,” bigWidth”:728,”bigHeight”:546,”licensing”:”<div class=”mw-parser-output”></div>”}
    Data query. By this point, the database has been initialized. For each database, as many tables as you can create (there is a limit to the number of tables per database but most users don’t have to worry about that limit unless they’re working with enterprise level database). You can now query the data for reporting or any other administrative purposes. See more about running queries against the database.
  • X

    wikiHow is a “wiki” site, which means that many of the articles here are written by multiple authors. To create this article, 16 people, some of whom are anonymous, have edited and improved the article over time.

    This article has been viewed 7,787 times.

    The SQL server database is one of the most popular today, in part because it is so easy to create and maintain. With a graphical user interface (GUI) program like SQL Server Management, you no longer have to worry about manipulating the command line. Continue reading Step 1 to create a database and start entering your information in just a few minutes.

    Thank you for reading this post How to Create SQL Server Database at Tnhelearning.edu.vn You can comment, see more related articles below and hope to help you with interesting information.

    Related Search:

    Related Posts

    How to Create Curved Text in Photoshop
    How to fall asleep faster
    How to Install FBReader to Read eBooks

    Category: How To

    Previous Post: « What is a snowflake vegetable that is more expensive than meat? Where to buy snowflake vegetables?
    Next Post: What is poison sumac allergy? Causes and prevention of allergies »

    Copyright © 2025 · Tnhelearning.edu.vn - Useful Knowledge