So I’m designing a database in MySQL Workbench for the first time. Previously they’ve all been on scraps of paper. Designing a database in MySQL has a lot of benefits. The biggest of which is the ability to populate it with data and test it as you go, not only for queries but also to see how long these queries take, i.e. the efficiency. However, problems loom their ugly head when you want to change things.
Adding a column
ALTER TABLE player ADD player_id VARCHAR(32);
Delete a column
ALTER TABLE player DROP playerid;
Altering a data type
Previously I had used a String as a player_id. Now, I’m still not sure if this is a more efficient data type for player ids (I’ll revisit this again in the future). As the player_id is only going to be compared to another player_id it is never going to have any kind of mathematical operation performed upon it. We will put this question on the back burner – but we won’t forget!
ALTER TABLE player MODIFY player_id BIGINT;