In today’s video, I’m going to show you how to create a new table in SQL Server Management Studio, also known as SSMS.
To get started:
1. Go into the Windows start bar, and type in “SSMS” and click on the “SQL Server Management Studio” search result to open it up.
2. Once SQL Server opens up, enter your database credentials, and connect to your database by clicking on the “Connect” button.
3. From the object explorer on the left, expand the “Databases” folder, then expand the database you’d like to add a new table to, for me this is the “Test Database 1” folder.
4. Now right click on the “Tables” folder, and select “New”, and then “Table”.
5. A new table tab will open up.
6. From here, you’re going to want to type in the name of your first column, for me, I’m going to create a table for computer parts, so I’m going to type in “partNumber”, and select the data type as “varchar(50)”.
7. Now, for the next column, I’m going to type in “partDescription”, and select the data type as “varchar(50)”.
8. Now I’m going to uncheck “Allow nulls” for both of my columns, since I don’t want both of these columns to always have data in them for any given record.
9. Now I’m going to right click on the arrow icon next to the “partNumber” column, and click on the “Set Primary Key” menu option. This ensures that the table won’t allow more than one record with the same part number in it.
10. Now to save the table, click on the “X” icon to close the tab, then click on the “Yes” button.
11. Now from this dialog window, you need to give your table a name, I’m going to type in “Parts”.
12. Your new table will now be created. If you go to the object explorer on the left hand side, then right click on the “Tables” folder, and select “Refresh”, your new table will now display.
13. Now if we expand the folder for the new table, we can see the tables columns that we created.
14. Now if you would like to create records in this new table, simply right click on the new table, and click on the “Edit top 200 rows” menu option.
15. Now to save these new records in the table, click the “X” button on this tab to close it.
16. Now if we right click on the new table, and click on the “Select top 1000 rows” menu option, SQL Server will now display all of the top 200 records in the table.
17. As you can see, the two records we just entered are now visible in the table.
And it’s as easy as that, creating a new table in SQL Server Management Studio is a fairly easy task to perform.
#sql #sqlserver #table
Информация по комментариям в разработке