m |
m |
||
Line 1: | Line 1: | ||
− | < | + | <seo title="How to create a database table" metakeywords="database table,create database table,new table,create sqltable" metadescription="How to create a database table" /> |
− | + | <div align=justify>All [http://myidealhost.com/hosting.shtml web hosting plans] provided by [http://myidealhost.com/ MyIdealHost] provides cPanel and it includes the database management application called phpMyAdmin. You can create tables, modify content of the databases, remove it, repair and optimize MySQL tables, etc. In this tutorial we'll let you know how to create a database table using phpMyAdmin. | |
− | + | First, log into your '''cPanel => [[Databases]] => phpMyAdmin'''. From the left-side list choose the database you wish to add a new sql table for. | |
− | + | {{#icon: phpMyAdmin.png|phpMyAdmin}} | |
+ | To create the database table, enter the desired table name and the number of fields at the bottom of the page. Click '''Go''' to create the new table. | ||
+ | |||
+ | {{#icon: new table.png|create a database table}} | ||
+ | |||
+ | On the screen that opens you'll be asked to enter the fields' names and the corresponding properties. | ||
+ | |||
+ | {{#icon: create database table.png|create a database table}} | ||
+ | |||
+ | The properties are as follows: | ||
* '''Type''' | * '''Type''' | ||
− | This field allows you to pick the type of the data stored in the corresponding field. See more about the possible choices [http://dev.mysql.com/doc/refman/5.0/en/data-types.html here]. | + | This field allows you to pick the type of the data stored in the corresponding field. See more about the possible choices '''[http://dev.mysql.com/doc/refman/5.0/en/data-types.html here]'''. |
− | + | ||
* '''Length/Values''' | * '''Length/Values''' | ||
− | The length of the database table field should be entered here. In case the field type is "enum" or "set", enter the values using the following format: 'a','b','c', etc. | + | The length of the database table field should be entered here. In case the field type is "enum" or "set", enter the values using the following format: '' 'a','b','c' '', etc. |
− | + | ||
* '''Collation''' | * '''Collation''' | ||
Line 26: | Line 33: | ||
You can choose the following attributes: | You can choose the following attributes: | ||
− | + | '''''BINARY''''' - the field collation will be binary, e.g. ''utf8_bin''; | |
− | + | '''''UNSIGNED''''' - the database table field will have positive or 0 numeric values; | |
− | + | ||
− | + | '''''UNSIGNED ZEROFILL''''' - the field will have positive or 0 numeric values and leading zeros will be added to a number; | |
− | + | ||
− | + | ||
+ | '''''ON UPDATE CURRENT_TIMESTAMP''''' - the current timestamp is the default value for the data type field, and is automatically updated; | ||
* '''Null''' | * '''Null''' | ||
− | This allows you to define whether the field value can be NULL. More information about the NULL value can be found [http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html here]. | + | This allows you to define whether the field value can be NULL. More information about the NULL value can be found '''[http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html here]'''. |
− | + | ||
* '''Default''' | * '''Default''' | ||
Here you can set the default value for the field. | Here you can set the default value for the field. | ||
− | |||
* '''Extra''' | * '''Extra''' | ||
Line 51: | Line 54: | ||
The radio buttons specify an Index for the particular field and the Index type. | The radio buttons specify an Index for the particular field and the Index type. | ||
− | |||
* '''Comments''' | * '''Comments''' | ||
Line 60: | Line 62: | ||
− | Now you know how to create a database table and | + | Now you know how to create a database table and can add new sql tables to any MySQL database under your account.</div> |