Join Adam Wilbert for an in-depth discussion in this video Creating a table's primary key in SQL Server Management Studio, part of Database Fundamentals: Storage.
- View Offline
- There are several ways to establish a tables' primary key…in Management Studio.…Let's take a look first at using the…graphical user interface.…I'm going to come over here to my…H Plus Active Database…and I'll go into the Tables folder here…and right click and Choose table.…That'll start up a new table editing session…where we can create a new table,…and I'm going to create a new table here…that's based around the credit card details allied…that we saw in the last chapter.…So the first field is going to be the Credit Card Number.…And its data type is going to be char16,…which will store the 16 digits of our credit cards.…
And I'm not going to allow nulls here…in this particular field.…The second field will be the Credit Card Expiration Date.…And this will be the Date data type here.…And for this one we can allow a null value,…just in case somebody doesn't know what…the expiration date is, they don't have to supply it.…Now in order to establish the primary key on this table,…all we need to do is select the field we want to serve…
Note: This course will also prepare certification candidates for the "Understanding data storage" domain of the Microsoft Technology Associate (MTA) Exam 98-364, Database Administration Fundamentals. Find out more at https://www.microsoft.com/learning/en-us/exam-98-364.aspx.
- Reducing redundancy with normalization
- Fixing partial dependencies
- Creating primary keys
- Linking tables with foreign keys
- Creating clustered and nonclustered indexes