MySQL – Get row number on select

Can I run a select statement and get the row number if the items are sorted? I have a table like this: mysql> describe orders; +————-+———————+——+—–+———+—————-+ | Field | Type | Null | Key | Default | Extra | +————-+———————+——+—–+———+—————-+ | orderID | bigint(20) unsigned | NO | PRI | NULL | auto_increment | | … Read more

Copy values from one column to another in the same table

How can I make a copy values from one column to another? I have: Database name: list ——————- number | test ——————- 123456 | somedata 123486 | somedata1 232344 | 34 I want to have: Database name: list —————- number | test —————- 123456 | 123456 123486 | 123486 232344 | 232344 What MySQL query … Read more

How to find the mysql data directory from command line in windows

In linux I could find the mysql installation directory with the command which mysql. But I could not find any in windows. I tried echo %path% and it resulted many paths along with path to mysql bin. I wanted to find the mysql data directory from command line in windows for use in batch program. … 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