Ken,

> > Check out DAYOFMONTH() and MONTH() and a wealth of other useful date
> > functions. RTFM: 6.3.4 Date and Time Functions
> There's a few interesting items here OK, Thanks for the pointer.

Go for it...

> > The answer to your question about AUTO_INCREMENT 'reset' can be
found at
> > 6.5.3 CREATE TABLE Syntax under "table_options".
>    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> EH? It says what?? I'm so green that this makes NO sense at all.
>
> Regards,table_options:
>         TYPE = {BDB | HEAP | ISAM | InnoDB | MERGE | MRG_MYISAM |
MYISAM }
> or      AUTO_INCREMENT = #


You asked:
> Off Topic,  I saw something about resetting the auto-increment
counter, but
> now I can't find reference to it. Can some kind soul enlighten me???

Sorry to overwhelm you with jargon - it can be difficult to assess a
person's capabilities over the email. So by way of a general answer may
I point you at the MySQL and PHP web site home pages, and from there to
their links to tutorial books and web sites. These will help you with
concepts and examples.

The reference to "6.5.3 CREATE TABLE Syntax" is in the electronic manual
at http://www.mysql.com/doc/C/R/CREATE_TABLE.html. The CREATE TABLE
command enables you to (re-)build a table by defining its 'schema'
(definitions, rules and/or constraints). The very next section of the
manual, 6.5.4 ALTER TABLE Syntax deals with making changes to a table's
structure.

If you are starting from scratch the former applies. If amending an
existing table, then the latter is of more interest. Logically enough
both follow much the same rules in terms of what you can/can't do.

Reading the CREATE TABLE command 'template', we see:

CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name
[(create_definition,...)]
[table_options] [select_statement]

"table options" is therefore something that may be included almost at
the end of the command. "may" is indicated by the square brackets =
optional. So a 'bare' command would include the words CREATE and TABLE,
followed by a table name, and then defining one or more fields within
parentheses. eg

CREATE TABLE Cinfo
( Cid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  Fname  TEXT)

The contents of the parentheses - a list of fields and their
definitions, are templated by the two lists: "create_definition" and
"type". Once the fields are defined (and the parentheses closed) you MAY
then decide to add further descriptions of the table. These are defined
in the "table_options" definitions, and include an additional
specification of interest to you:

AUTO_INCREMENT = #

If you add this clause to the above and replace the # with a suitable
integer, you can define the starting sequence number to be used in the
ID column, eg:

CREATE TABLE Cinfo
( Cid INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
  Fname  TEXT)
AUTO_INCREMENT = 1001;

Hope that's enough to get you re-started. If you plug "AUTO_INCREMENT"
into the electronic manual's search facility you find a ton of stuff
showing you how to use such columns/series - and a few warnings.

Ok?
=dn


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to