Jump to content
xisto Community
Sign in to follow this  
alexviii

Creating Tables In Mysql

Recommended Posts

Hi everyone!

I have a problem: when I create a table in MySQL,  I'm asked to fill up some information about each column.

for example:-

| Name | Type | Value | 2nd Value | Attributes | Null | Default | what do they are??

name, default it's ok,  I know them. But the others??? Type. 

for example,  I have to choose between :-

Quote

VARCHAR, TINYINT, SMALLINT, MEDIUMINT, INT, INTEGER, BIGINT, FLOAT, DOUBLE, REAL, DECIMAL, NUMERIC, DATE, TIME, DATETIME, TIMESTAMP, YEAR, CHAR, VARCHAR, TINYBLOB, TINYTEXT, BLOB, TEXT and others....

Or also in Attibutes:

Quote

"NONE, UNSIGNED, BINARY, ZEROFILL"

May some one explain that? or,  is there a link that you know I can find explanation to that?

10x,  Bye

Share this post


Link to post
Share on other sites

I'll just explain each one to the best of my ability - Name - the name of the column, pretty self-explanatory (e.g., "username")Type - you got it, one of those data types (e.g., VARCHAR(20) = 20 char string)Value - the information stored in that column (e.g., "alexviii")2nd Value - I've never used it, I guess it's just another value, thoughAttributes - not sure, might be something like primary key, etc.Null - whether or not it can be null (an optional field would be able to be null)Default - the default value, usually null if it can be null

Share this post


Link to post
Share on other sites

While making a table you need to give it its name.
How would you query it otherwise ?

Also the type means what type of data.
Numeric or Alphanumeric.

Numeric can store only numbers while Alphanumeric can store both but it can be used in calculations as it is regarded as a string.

Also all Alphanumeric are having default value as NULL unless you give it some value as defualt.

All numeric ones have 0 as default unless you give a default number.

A good tutorial site:
http://www.w3schools.com/sql/default.asp

Hope it helps

Share this post


Link to post
Share on other sites

Name -> the name of the column.Type -> Type of the column (Varchar for alphanumeric, char same, INT for numeric, text for large string, BLOB for binary data like sounds or images)Value -> the length of the column in integer (e.g: 5 for integer means INT(5) so this column can countain like 54321Attribut -> I never fill itNull -> wheter this column can be empty or not.Default -> the default value for this columnAlsoAUTO_INCREMENT -> the value of this column always increase by 1 if you add new record.PRIMARY_KEY -> no duplicate value for this columnUNIQUE -> no duplicate value <_<

Share this post


Link to post
Share on other sites

10x guys, Let's Say I have to make a table like this: Id = Autoincremet id username password realname = the name of the applicant realsurname= his surname country = chosen from a list of countrys in the form e-mail url = web site avatar = which is uploaded in the form rank = auotomaticaly is always 1 (than from the admin it can be changed to 2 or 3 etc..) date = when he register Thoese are the information that I need to store for all client. How do I create a querry for that?? 10x

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.