Re: [PHP-DB] How do I know when to

2002-01-11 Thread Raquel Rice

On Fri, 11 Jan 2002 17:21:28 -0800
Jerry Leonard "Jerry Leonard" <[EMAIL PROTECTED]> wrote:

> Okay this is the way I understand the statement below. The uid
> will be a
> number from 1 to 10, max length of ten digits say starting at 1
> then as the
> next user registers it will automatically make that user number 2.
> 
> Am I correct?
> 
> CREATE TABLE users (
>   uid int(10) unsigned NOT NULL auto_increment,

You are correct that it will automatically increment the 'uid' of
each new record beginning with '1', using the digits 0 - 9 (1 to
99).

Check out the manual for "Create Table".

-- 
Raquel

Nothing happens in consequence to nature, only in consequence to
what we know of it.
  --Scully, "X-Files"

  
  

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] How do I know when to

2002-01-11 Thread Jerry Leonard

Okay this is the way I understand the statement below. The uid will be a
number from 1 to 10, max length of ten digits say starting at 1 then as the
next user registers it will automatically make that user number 2.

Am I correct?

CREATE TABLE users (
  uid int(10) unsigned NOT NULL auto_increment,





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] How do I know when to

2002-01-11 Thread Miles Thompson

Jerry,

Raquel Rice has already answered your question, I'd suggest looking up some 
basic tutorials on relational databases. This one is pretty 
good:  http://www.devshed.com/Server_Side/MySQL/Normal

A  good database design is important because it's the foundation of all the 
rest of your work, and you can use the power of SQL to eliminate a lot of 
processing loops you would otherwise have to write, whether in PHP or some 
other language.

Char vs varchar? It probably doesn't matter, although I prefer to get my 
field lengths as close to the length of my data as possible, and I suspect 
that there has to be some processing overhead with a varchar type. Having 
said that a MySQL expert will probably read the post and say "Huh, he 
doesn't know what he's talking about. MySQL stores all chars as varchars."

Welcome to the club and have fun - Miles Thompson


At 03:02 PM 1/11/2002 -0800, Jerry Leonard wrote:
>Hi,
>
>I am really new to MySQL and am wondering this:
>
>I understand how to make a database and tables but what I don't understand
>is when to make a row an "int" with auto_increment or just a plain "int".
>Or why would you use varchar(50) instead of char(50).
>
>Could someone please explain what is happening and why?
>
>Thank you
>Jerry
>
>
>
>--
>PHP Database Mailing List (http://www.php.net/)
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] How do I know when to

2002-01-11 Thread Raquel Rice

On Fri, 11 Jan 2002 15:02:00 -0800
Jerry Leonard "Jerry Leonard" <[EMAIL PROTECTED]> wrote:

> Hi,
> 
> I am really new to MySQL and am wondering this:
> 
> I understand how to make a database and tables but what I don't
> understand
> is when to make a row an "int" with auto_increment or just a plain
> "int".
> Or why would you use varchar(50) instead of char(50).
> 
> Could someone please explain what is happening and why?
> 
> Thank you
> Jerry

Personally I would never create a row that was "'int' with
auto_increment".  However, I often create columns that are.  When I
do, I use those columns as unique identifiers for a particular row. 
Any of the other data may change in the row, but the unique
identifier will always remain the same.  The price of an item may
change, as well as the packing quantity, the description and even
your part number scheme, but the unique ID always remains the same.

I use 'varchar(50)' when my data is of variable length because the
storage space automagically grows up to 50 characters, thus using
less space.  'char(50)' is just what it says, space enough to hold
50 characters.

-- 
Raquel

Nothing happens in consequence to nature, only in consequence to
what we know of it.
  --Scully, "X-Files"

  
  

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DB] How do I know when to

2002-01-11 Thread Jerry Leonard

Hi,

I am really new to MySQL and am wondering this:

I understand how to make a database and tables but what I don't understand
is when to make a row an "int" with auto_increment or just a plain "int".
Or why would you use varchar(50) instead of char(50).

Could someone please explain what is happening and why?

Thank you
Jerry



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]