Databases| SQL| MySQL| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
MySQL Create Table 
 

Here, you will read the brief description about the MySQL create table. The CREATE TABLE statement is used for creating a table in database.

 

MySQL Create Table

                         

Here, you will read the brief description about the MySQL create table. The CREATE TABLE statement is used for creating a table in database. 

There are following way to create MySQL table:

 

 

 

 

 

 

 

 

Syntax: 

CREATE TABLE tablename(column1name type, column1name type,.........);

This is a basic CREATE TABLE statement that should work in any sql database.

Query

CREATE TABLE table_example(id int, name varchar(50),description varchar(200));

If you want to know about the created table then you write the following query:

Query

DESC table_example;

Output:

To create a table with a particular storage engine

If you create table without specifying the ENGINE option then server will use the default storage engine MyISAM. If you want to use other, storage types must be defined.

Query

CREATE TABLE table_example1(id int, name varchar(50),description varchar(200))ENGINE=innodb;

ENGINE=innodb is the method of defining the storage type.

Execute the Query "DESC table_example1;" to see the table structure:

Output:

To create a table with auto-increment: If you use auto-increment then you will be able to automatically assign the value to a specified column. The auto-increment property should not be null. In the table created from the query below, the data in the "id" column will be added automatically if not specified.

Query

CREATE TABLE table_example2(id int NOT NULL AUTO_INCREMENT PRIMARY KEY, stuName varchar(50));

Execute the Query "DESC table_example2;" to see the table structure:

Output:

 

                         

» View all related tutorials
Related Tags: php sql mysql c table data ui insert datatypes types type tutorial field name using ria create tab ie example

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.