Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

James Corr
James Corr
2,678 Points

Can someone explain how to read the syntax reference manual?

I'm working through the database foundations course but I don't quite understand how to use the MySQL Reference Manual. Or maybe I just need an explanation of the hierarchy of the manual.

The reference manual I'm referring to is seen here with the ALTER TABLE command: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

For example how would I add a column and make it the first column in the table. I know FIRST goes in the syntax but I wouldn't be able to understand where without the video telling me where.

2 Answers

Ken Alger
Ken Alger
Treehouse Teacher


SQL commands can be a challenge at first and sometimes the documentation is indeed confusing, but with some practice I am sure it will come easy.

With regards to your specific question as to how to add your column.

USE database_name;

This will add a Column named column_name of type INTEGER as the first column to the table table_name, in the database database_name.

If you set up a practice database in MySQL and use the admin tools to try some various commands out based on the documentation it can be extremely helpful for the learning process.

Hope it helps.


Hi James,

If you add a column without specifying a position it will be placed last, by default. If you want the column to be placed first in the table you would simply write:

ALTER TABLE categories ADD COLUMN another_column VARCHAR(100) FIRST;

ALTER TABLE [IGNORE] tbl_name ADD [COLUMN] col_name col_definition FIRST;

Basically everything is in the order you would write it. The items in square brackets [] are optional and the items in bold are mandatory.

Also, the version of MySQL may change the syntax. I'm using 5.5.37 for debian-linux-gnu and using parenthesis around the column definition wouldn't work.