Top "Primary-key" questions

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

Can I use VARCHAR as the PRIMARY KEY?

I have a table for storing coupons/discounts, and I want to use the coupon_code column as the primary …

mysql sql primary-key unique varchar
sql primary key and index

Say I have an ID row (int) in a database set as the primary key. If I query off the …

sql sql-server tsql indexing primary-key
Merge multiple Excel workbooks based on key column

I get seven workbooks (xlsx files) from different clients, each with one sheet. Each sheet has at least one common …

excel primary-key unique vlookup
Creating a Primary Key on a temp table - When?

I have a stored procedure that is working with a large amount of data. I have that data being inserted …

sql-server indexing primary-key temp-tables
Primary and Foreign Key at the same time

Would it be possible in SQL Server 2008 to have a table created with 2 columns that are at the same time …

sql-server foreign-keys primary-key
What is the difference b/w Primary Key and Unique Key

I tried to find it out in google but not satisfactory answer is given out there. Can anybody explain the …

primary-key unique-key
Using Rails, how can I set my primary key to not be an integer-typed column?

I'm using Rails migrations to manage a database schema, and I'm creating a simple table where I'd like to use …

ruby-on-rails database migration primary-key
SQL - Inserting a row and returning primary key

I have a little witty problem. Say, I inserted a row with some data in a table where a primary …

sql sqlite insert row primary-key
How to reset the primary key of a table?

In my table tbphotos I had a 100 records. I then deleted all the records and now that I want to …

mysql primary-key
Reset PostgreSQL primary key to 1

Is there a way to reset the primary key of a PostgreSQL table to start at 1 again on a populated …

postgresql primary-key reset