Top "Primary-key" questions

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

How to 'insert if not exists' in MySQL?

I started by googling, and found this article which talks about mutex tables. I have a table with ~14 million records. …

php mysql sql primary-key sql-insert
Add primary key to existing table

I have an existing table called Persion. In this table I have 5 columns: persionId Pname PMid Pdescription Pamt When I …

sql sql-server sql-server-2008 constraints primary-key
difference between primary key and unique key

I'm using mysql database. I have a confusion between primary key and unique key. Please help me where should I …

mysql sql database primary-key unique-key
SQL Server add auto increment primary key to existing table

As the title, I have an existing table which is already populated with 150000 records. I have added an Id column (…

sql-server sql-server-2008 primary-key alter-table
Remove Primary Key in MySQL

I have the following table schema which maps user_customers to permissions on a live MySQL database: mysql> describe …

mysql sql database-design primary-key mysql-error-1075
ALTER TABLE to add a composite primary key

I have a table called provider. I have three columns called person, place, thing. There can be duplicate persons, duplicate …

mysql sql primary-key alter-table composite-primary-key
How to properly create composite primary keys - MYSQL

Here is a gross oversimplification of an intense setup I am working with. table_1 and table_2 both have auto-increment surrogate …

mysql primary-key myisam composite-key composite-primary-key
Unable to update the EntitySet - because it has a DefiningQuery and no <UpdateFunction> element exist

I am using Entity Framework 1 with .net 3.5. I am doing something simple like this: var roomDetails = context.Rooms.ToList(); foreach (…

c# asp.net .net entity-framework primary-key
How to reset postgres' primary key sequence when it falls out of sync?

I ran into the problem that my primary key sequence is not in sync with my table rows. That is, …

postgresql primary-key database-sequence