Surrogate vs. natural/business keys [closed]

Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 years ago. Improve this question Here we go again, the old argument still arises… Would we better have a business key … Read more

Is there a REAL performance difference between INT and VARCHAR primary keys?

Is there a measurable performance difference between using INT vs. VARCHAR as a primary key in MySQL? I’d like to use VARCHAR as the primary key for reference lists (think US States, Country Codes) and a coworker won’t budge on the INT AUTO_INCREMENT as a primary key for all tables. My argument, as detailed here, … Read more

Strings as Primary Keys in SQL Database [closed]

Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I am not very familiar with databases and the theories behind how they work. Is it any slower from a … Read more

Remove Primary Key in MySQL

I have the following table schema which maps user_customers to permissions on a live MySQL database: mysql> describe user_customer_permission; +——————+———+——+—–+———+—————-+ | Field | Type | Null | Key | Default | Extra | +——————+———+——+—–+———+—————-+ | id | int(11) | NO | PRI | NULL | auto_increment | | user_customer_id | int(11) | NO | PRI … Read more

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 primary keys as the ID. info is a table that contains information about both table_1 and table_2. table_1 (id, field) table_2 (id, field, field) info ( ???, field) I am trying to decided if I … Read more

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 places, and duplicate things, but there can never be a dupicate person-place-thing combination. How would I ALTER TABLE to add a composite primary key for this table in MySQL with the these three columns? 6 … Read more