Basics on tables in Mysql

Navigating around in mysql is quite easy. You can see which databases by using the command “show databases”. There will always exist a database called “mysql” which is used by mysql itself.

If your user account has access to a database, you can access it by using the “use DATABASENAME” command. You can se which tables exist within a database by using the “show tables” command - and see details for each table by issuing the “desc TABLENAME” command.

changing Tables

All alterations of database tables is done with the alter table command. The main challenge is use the command beyond just making it work. Here’s a few clues to get the most of it.

Let’s make a simple table as an example:

create table demotable (
id integer unsigned not null auto\_increment primary key);
{{ /highlight }}
### Adding a column

<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sql" data-lang="sql"><span style="display:flex;"><span><span style="color:#66d9ef">ALTER</span> <span style="color:#66d9ef">TABLE</span> demotable <span style="color:#66d9ef">ADD</span> <span style="color:#66d9ef">COLUMN</span> label CHAR(<span style="color:#ae81ff">20</span>);</span></span></code></pre></div>
## More...

Find more details in the [Mysql manual](