»
S
I
D
E
B
A
R
«
MySQL Remove a Column
Apr 14th, 2010 by admin

To remove a column in MySQL is easy.

ALTER TABLE users DROP email;

Although it is very simple, but use it with caution as it permanently removes data without a warning.

MySQL Select a Database
Apr 13th, 2010 by admin

To select a database is not a query. It is a ‘statement’ and does not require a semicolon at the end. Here is how you can do it:

USE recruit_db

It tells MySQL to select ‘recruit_db’ as the default database to work with, for the current session.

MySQL Delete a Table
Apr 13th, 2010 by admin

To delete a table in MySQL, you can use the DROP TABLE command, for instance:

DROP TABLE users;

Be careful while using this function, this query deletes a table and its contents, without a warning.

MySQL Show Table Structure
Apr 13th, 2010 by admin

To see the structure of an existing table, you can use this query.

EXPLAIN countries;

In the example above, fields (aka. columns) from a table named ‘countries’ are listed in the results, with their properties.

MySQL List All Databases
Apr 12th, 2010 by admin

In MySQL, the command to list all databases looks like the one below:

SHOW DATABASES;

This query is used to get a list of all databases you have.