Top "Primary-key" questions

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

Change Primary Key to Composite Key (Primary Key already exists)

I am trying to change the primary key of a table in my SQL database from the existing key to …

sql sql-server primary-key composite-primary-key
Is an index needed for a primary key in SQLite?

When an integer column is marked as a primary key in an SQLite table, should an index be explicitly created …

sqlite indexing primary-key
CREATE TABLE AS with PRIMARY KEY in one statement (PostgreSQL)

Is there a way to set the PRIMARY KEY in a single "CREATE TABLE AS" statement? Example - I would …

postgresql primary-key create-table
Mysql Innodb: Autoincrement non-Primary Key

Is it possible to auto-increment a non-Primary Key? Table "book_comments" book_id medium_int timestamp medium_int user_id …

mysql primary-key innodb
How do I determine if a column is in the primary key of its table? (SQL Server)

I am currently using... select Table_Name, Column_name, data_type, is_Nullable from information_Schema.Columns ...to determine information …

sql-server code-generation primary-key data-access-layer
JPA @OneToMany and composite PK

I am working on a JPA project. I need to use a @OneToMany mapping on a class that has three …

jpa persistence primary-key many-to-one
How to to create unique random integer ID for primary key for table?

I was wondering if anybody knew a good way to create a unique random integer id for a primary key …

mysql sql primary-key uniqueidentifier
Should a database table always have primary keys?

Should I always have a primary key in my database tables? Let's take the SO tagging. You can see the …

database primary-key modeling
Composite Primary Key performance drawback in MySQL

We have a table with a composite Primary key consisting of three fields (and it is in MySQL 5.1). There are …

mysql performance primary-key composite-key
What are the performance improvement of Sequential Guid over standard Guid?

Has someone ever measured performance of Sequential Guid vs. Standard Guid when used as Primary Keys inside a database? I …

database primary-key guid