Auto Increment

Auto Increment

am 12.04.2005 17:11:08 von Groves David

Hello,

This is a silly question, at least for those of you who know about MySql. I
am building a db for my site, and to, get to nf3 have created a table for
each room in a house. The question is this.

1. Can I have more than one PK in some tables, if so
2. When someone makes an entry into those different table , if the PK is set
to auto increments will it be the same number in each table. IE table room1,
room2, room3 these are three different table. Someone makes the first entry,
would id Pk = 0 in all three tables?

Explained it as well as I can do?

Kind Regards

DG


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: Auto Increment

am 12.04.2005 18:10:36 von Joseph Connolly

Please for the love of god, read the manual or google it

david groves wrote:

>Hello,
>
>This is a silly question, at least for those of you who know about MySql. I
>am building a db for my site, and to, get to nf3 have created a table for
>each room in a house. The question is this.
>
>1. Can I have more than one PK in some tables, if so
>2. When someone makes an entry into those different table , if the PK is set
>to auto increments will it be the same number in each table. IE table room1,
>room2, room3 these are three different table. Someone makes the first entry,
>would id Pk = 0 in all three tables?
>
>Explained it as well as I can do?
>
>Kind Regards
>
>DG
>
>
>
>



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: Auto Increment

am 12.04.2005 21:42:43 von Joseph Connolly

If you read the manual there is a tutorial on setting up table and
defining data types. In ADDITION there is extenseive talk about keys and
contraints. If you do not leanr how to use the information given to you,
you will never learn. Perhaps you don't really want to use a Primary key
in each scenario but would rather use UNIQUE. PErhaps you just need an
INDEX on the columns. Maybe you need to have cascading updates and
inserts in which case you will need a InnoDB table as opposed to a
IMysam. If you read the manual all this information is there for you to
read and then try to decide which strategy is best for you.


linkhomes2000 wrote:

>Thank you for that very intuitive answer. Its so nice to meet such helpful
>people?
>
>DG
>----- Original Message -----
>From: "Joseph Connolly"
>Cc:
>Sent: Tuesday, April 12, 2005 5:10 PM
>Subject: Re: Auto Increment
>
>
>
>
>>Please for the love of god, read the manual or google it
>>
>>david groves wrote:
>>
>>
>>
>>>Hello,
>>>
>>>This is a silly question, at least for those of you who know about MySql.
>>>
>>>
>I
>
>
>>>am building a db for my site, and to, get to nf3 have created a table for
>>>each room in a house. The question is this.
>>>
>>>1. Can I have more than one PK in some tables, if so
>>>2. When someone makes an entry into those different table , if the PK is
>>>
>>>
>set
>
>
>>>to auto increments will it be the same number in each table. IE table
>>>
>>>
>room1,
>
>
>>>room2, room3 these are three different table. Someone makes the first
>>>
>>>
>entry,
>
>
>>>would id Pk = 0 in all three tables?
>>>
>>>Explained it as well as I can do?
>>>
>>>Kind Regards
>>>
>>>DG
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>--
>>MySQL Windows Mailing List
>>For list archives: http://lists.mysql.com/win32
>>To unsubscribe:
>>
>>
>http://lists.mysql.com/win32?unsub=linkhomes2000@btconnect. com
>
>
>>
>>
>
>
>
>



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

RE: Auto Increment

am 14.04.2005 02:38:31 von jbonnett

Each table can have only one primary key (PK) but you can also access
the table by other columns. If you want this access to be efficient you
can set up indexes on those columns. Read the documentation, there are
many options.

For auto-increment keys each table is managed independently. If you
create 3 tables with an auto-increment column and insert a record in
each, then each one will have 1 in that column.

It is not clear what you are doing with your database, but do you really
need a table for each room? You may do just as well with one table that
has a column that identifies what room each row belongs to. Then you
would have only one auto-increment column to worry about.

John Bonnett

-----Original Message-----
From: david groves [mailto:grovesdavid@btconnect.com]=20
Sent: Wednesday, 13 April 2005 12:41 AM
To: win32@lists.mysql.com
Subject: Auto Increment

Hello,

This is a silly question, at least for those of you who know about
MySql. I
am building a db for my site, and to, get to nf3 have created a table
for
each room in a house. The question is this.

1. Can I have more than one PK in some tables, if so
2. When someone makes an entry into those different table , if the PK is
set
to auto increments will it be the same number in each table. IE table
room1,
room2, room3 these are three different table. Someone makes the first
entry,
would id Pk =3D 0 in all three tables?

Explained it as well as I can do?

Kind Regards

DG


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org