Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Databases

Database

How to create table using Primary key

Ken Alger
Ken Alger
Treehouse Teacher

We're going to need more information than that to be helpful. What database are you using? Does this revolve around a particular course or code challenge?

Please post back and I'm sure we can get you headed in the right direction.

Thanks,
Ken

1 Answer

Steven Parker
Steven Parker
229,788 Points

Here's a very generic example.

The syntax may vary slightly depending on which database you use, but for a generic example:

CREATE TABLE new_table
( Id int NOT NULL,
  PRIMARY KEY (Id)
);

In future, if you name your database and/or provide a link to the course video or challenge, it would make a more specific answer possible.