Warlord
09-18-2004, 01:44 AM
I requested a hack in the requests forum and then thought I'd try to make it myself I went to a site to learn a little about mysql, but I have a question for anyone that can answer.
I took their mysql commands:
CREATE TABLE employees ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');
And edited them to reflect more of what I think I want my table to look like:
CREATE TABLE bios ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, name varchar(30), secretidentity varchar(50), groupaffiliation varchar(255), height varchar(10), weight varchar(10), haircolor varchar(20), eyecolor varchar(20), powers varchar(255), history varchar(255), PRIMARY KEY (id), UNIQUE id (id));
Now, I think I've figured out what most of these commands do, and what they stand for but a few I'm not to sure about, and I'd rather know what they all do then copy and paste them (I remember them better when I understand their function)
create table obviously creates the table (duh)
I assume the ( after bios lets phpMyAdmin know that the columns are about to follow?
What does id tinyint(4) DEFAULT '0' NOT NULL do? Is this one long command or 3? (Looks like three to me)
AUTO_INCREMENT sounds like it's telling phpMyAdmin that you want it to count and assign each row of data a number sequentially (1, 2, 3, etc) Yes?
varchar is obviously the character limit.. but what does var stand for? And why is the max limit only 255? How do you get around this max limit? phpMyAdmin said to use BLOB instead, but how do I use that?
What does PRIMARY KEY (id) do?
What does UNIQUE id (id) do?
The last) seems to be some sort of closing tag letting the server know it's done inserting columns. And I would guess the ; is to let the server know that the entire command is done?
Any help you all can provide is appreciated. After I have the answers to these questions, I will likely have more, so thanks in advance for you patience with me.
-WL
I took their mysql commands:
CREATE TABLE employees ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, first varchar(20), last varchar(20), address varchar(255), position varchar(50), PRIMARY KEY (id), UNIQUE id (id));INSERT INTO employees VALUES (1,'Bob','Smith','128 Here St, Cityname','Marketing Manager');
And edited them to reflect more of what I think I want my table to look like:
CREATE TABLE bios ( id tinyint(4) DEFAULT '0' NOT NULL AUTO_INCREMENT, name varchar(30), secretidentity varchar(50), groupaffiliation varchar(255), height varchar(10), weight varchar(10), haircolor varchar(20), eyecolor varchar(20), powers varchar(255), history varchar(255), PRIMARY KEY (id), UNIQUE id (id));
Now, I think I've figured out what most of these commands do, and what they stand for but a few I'm not to sure about, and I'd rather know what they all do then copy and paste them (I remember them better when I understand their function)
create table obviously creates the table (duh)
I assume the ( after bios lets phpMyAdmin know that the columns are about to follow?
What does id tinyint(4) DEFAULT '0' NOT NULL do? Is this one long command or 3? (Looks like three to me)
AUTO_INCREMENT sounds like it's telling phpMyAdmin that you want it to count and assign each row of data a number sequentially (1, 2, 3, etc) Yes?
varchar is obviously the character limit.. but what does var stand for? And why is the max limit only 255? How do you get around this max limit? phpMyAdmin said to use BLOB instead, but how do I use that?
What does PRIMARY KEY (id) do?
What does UNIQUE id (id) do?
The last) seems to be some sort of closing tag letting the server know it's done inserting columns. And I would guess the ; is to let the server know that the entire command is done?
Any help you all can provide is appreciated. After I have the answers to these questions, I will likely have more, so thanks in advance for you patience with me.
-WL