From the course: Database Foundations: Data Structures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Add a primary key to a table

Solution: Add a primary key to a table

From the course: Database Foundations: Data Structures

Start my 1-month free trial

Solution: Add a primary key to a table

(upbeat music) - [Instructor] I hope you were successful in adding in a new primary key column to the TwoTrees employees table. Let's walk through the solution together. I'm going to start by taking a look inside of my TwoTrees database that I have on the SQL server instance. You can do the same thing in the Postgre SQL database if you want it to. Some expand the tables folder. And there is the employees table that we created in the last challenge. If I take a look inside the columns folder I can see the existing columns, or another way to do this is just to create a new query, and select everything out of the table. So I'll just go ahead and run that real quick. And so this is our starting point. So we have first name, last name, phone number, office number, hire date, and the annual salary. Now, none of these columns are likely to be unique in a large table. We might eventually have somebody with the same first…

Contents