Creating and checking a new table

Creating new table in database is very simple. First of all you have to create database in MySQL i.e you created database name address.

USE command is used to use the database. i.e. USE address

Create table in the database

CREATE TABLE command is used to create table in database. i.e. CREATE TABLE profile. profile is a table name.

Bring it all together

mysql> USE  address;

mysql> CREATE TABLE profile (
           -> Name VARCHAR(128),
           -> Address VARCHAR(128),
           -> Email  VARCHAR(29)
           -> Year CHAR(4));

Checking table

DESCRIBE command is used to check the table you have created. i.e. DESCRIBE profile

mysql> DESCRIBE profile;

Field: Column within a table or name of field.

Type: Type of data stored in a field.

Null: Whether a field is allowed to contain a value of NULL.

Key: MySQL supports keys or indexes.

Default: The default value that will be assigned to the field.

Extra: Whether a field is set to auto-increment.

Leave a Reply