CHAR() – Fixed length field between 0 and 255 characters that can store any type of data. The length of the field is set regardless of the size of the data placed into it.
DATE – Date in YYYY-MM-DD format.
INT – Whole numbers only. The number of digits can also be specified in parentheses, but is not necessary.
TEXT – Variable length text-only field with a maximum length of 65535 characters.
TIME – Time in hh:mm:ss format.
VARCHAR() – Variable length field between 0 and 255 characters that can store any type of data. Unlike the CHAR() type, the length of each VARCHAR() field is determined by the data placed into it.
So, knowing this, let’s decipher our code example from the Creat Tables post.
<?php mysql_query(“
CREATE TABLE Employees
(open the query to the DB and make this table with Employees as the name)
(employee_id INT,
(make this field with employee_id as the name and allow only whole numbers)
first_name VARCHAR(50),
(make this field with first_name as the name, allow any input, and limit it to 50 characters in length)
last_name VARCHAR(50)”)
(make this field with last_name as the name, allow any input, and limit it to 50 characters in length)
?>
Once you get the basic concepts, data manipulation with MySQL is not difficult.
0 Comments
Leave a Reply. |
David Rentson
If this free PHP and MYSQL Tutorial is helpful for you... Great! Archives
October 2008
Categories
All
|