UNIQUE question – probably not!!

Beginner question…

First venture into creating a database in MySQL… how long ago that seems for many of you!

Well I am a guy who has learned early in life to keep things simple. I did proceed in this fashion and full of confidence decided to experiment with the most easy of creations. Created database, then a table and included 2 very very simple fields. (Not confidence I was to find however…but OVER CONFIDENCE!!)

Fell at the first fence.

The two fields were

(a) ID (int) length 5, Auto-increment, No tick in the “allow null” box and it is the PRIMARY key.

(b) comment (varchar) length 255, and once again no tick in the “allow null” box.

It worked perfectly – I thought… after about 5 records. No it did not, because I went in to alter record 4 (just to see if I could) to a figure of 64 – it let me do that. Next I entered another record automatically and its number became 65.

I realise that I am only just starting out, but it seems that I have been thinking wrongly that a PRIMARY auto-increment field was in some way UNIQUE and would be if you like “greyed out” or “unable to be changed”. That is what I was hoping to achieve. Otherwise I would imagine chaos could rein if you are able to change at will anything in that auto-increment field. It seems to be self-defeating.

What should I do to achieve this please, like I think I did once in Microsoft Access. Forgotten how I did that however! Grateful for assistance on this and many thanks. confused:

PS! This by the way was not done by coding directly, but by using a helper called NAVICAT, and just following the available inputs.

Hi guys

Thanks for looking in on my question, but do not bother replying now as I have given up on my studies regarding the subject.

To save repeating what I have just written on another of my postings here is the link.

http://forum.mysqlperformanceblog.com/s/t/179/

SEE LAST POSTING MADE BY ME ON THAT LINK.

All the best.
David
United Kingdom