$Three3 Posted January 1, 2010 Share Posted January 1, 2010 Hi, I have just begun to learn about connecting and adding entries to a MYSQL database but I am confused on one part of what I have read so far. When trying to Create a Table in the database, this is what the book says to write: CREATE TABLE entries (entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY , title VARCHAR(100) NOT NULL, entry TEXT NOT NULL, date_entered DATETIME NOT NULL) What I really do not grasp 100% is what the CAPITAL words really mean. If someone does not mind explaining the what this actually means it would be great. Thanks a lot in advance for the help. Link to comment https://forums.phpfreaks.com/topic/186874-need-help-with-mysql-table-code/ Share on other sites More sharing options...
Mchl Posted January 1, 2010 Share Posted January 1, 2010 CREATE TABLE - pretty obvious, you ask MySQL to create a table entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY - this is a definition of a column: INT UNSIGNED - it will be of type INT UNSIGNED http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html NOT NULL - it will not accept empty values AUTO_INCREMENT - http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html PRIMARY KEY - this column will be a primary key for this table title VARCHAR(100) NOT NULL - that's another column's definition VARCHAR(100) this column will be of type VARCHAR with maximum length of 100 http://dev.mysql.com/doc/refman/5.0/en/char.html TEXT - http://dev.mysql.com/doc/refman/5.0/en/blob.html DATETIME - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-types.html Full explanation of CREATE TABLE syntax - http://dev.mysql.com/doc/refman/5.0/en/create-table.html (It might seem confusing at first, but it actually is pretty well laid out) Link to comment https://forums.phpfreaks.com/topic/186874-need-help-with-mysql-table-code/#findComment-986877 Share on other sites More sharing options...
$Three3 Posted January 1, 2010 Author Share Posted January 1, 2010 CREATE TABLE - pretty obvious, you ask MySQL to create a table entry_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY - this is a definition of a column: INT UNSIGNED - it will be of type INT UNSIGNED http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html NOT NULL - it will not accept empty values AUTO_INCREMENT - http://dev.mysql.com/doc/refman/5.0/en/example-auto-increment.html PRIMARY KEY - this column will be a primary key for this table title VARCHAR(100) NOT NULL - that's another column's definition VARCHAR(100) this column will be of type VARCHAR with maximum length of 100 http://dev.mysql.com/doc/refman/5.0/en/char.html TEXT - http://dev.mysql.com/doc/refman/5.0/en/blob.html DATETIME - http://dev.mysql.com/doc/refman/5.0/en/date-and-time-types.html Full explanation of CREATE TABLE syntax - http://dev.mysql.com/doc/refman/5.0/en/create-table.html (It might seem confusing at first, but it actually is pretty well laid out) Thanks a lot man for those links and explanations. It really cleared things up for me. Thanks again Link to comment https://forums.phpfreaks.com/topic/186874-need-help-with-mysql-table-code/#findComment-986883 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.