Top "Primary-key" questions

A key is a set of attributes that is irreducibly unique and non-nullable within a table.

Sqlite primary key on multiple columns

What is the syntax for specifying a primary key on more than 1 column in SQLITE ?

sqlite primary-key ddl composite-primary-key
How can I define a composite primary key in SQL?

How can I define a composite primary key consisting of two fields in SQL? I am using PHP to create …

sql primary-key composite-primary-key
Insert auto increment primary key to existing table

I am trying to alter a table which has no primary key nor auto_increment column. I know how to …

mysql primary-key
Is it fine to have foreign key as primary key?

I have two tables: User (username, password) Profile (profileId, gender, dateofbirth, ...) Currently I'm using this approach: each Profile record has …

database foreign-keys primary-key
Updating MySQL primary key

I have a table user_interactions with 4 columns: user_1 user_2 type timestamp The primary key is (user_1,user_2,type) and …

mysql primary-key
How to add an auto-incrementing primary key to an existing table, in PostgreSQL?

I have a table with existing data. Is there a way to add a primary key without deleting and re-creating …

postgresql primary-key auto-increment
make an ID in a mysql table auto_increment (after the fact)

I acquired a database from another developer. He didn't use auto_incrementers on any tables. They all have primary key …

mysql primary-key auto-increment
Auto Increment after delete in MySQL

I have a MySQL table with a primary key field that has AUTO_INCREMENT on. After reading other posts on …

sql mysql primary-key auto-increment