Hi there,

As far as I know, MySQL does not have a CREATE TABLE command do that.

The only thing I can think of is if by "size" you mean "number of
rows".  (Which is directly proportional to the size in bytes if you do
not use variable-length fields, anyway.)

If so, you can have an autoincrement field, and write a trigger to
delete the first record once you get to the newest record.

For instance, if you want your table to always have 100 rows, the
trigger would have the algorithm:

(use this before the insert statement runs!)

if ( max(autoincrement_field) - min(autoincrement_field) < 99)
then
{ INSERT }
else {
delete from table where autoincrement_field=min(autoincrement_field)
INSERT
}

Please note that I've never really looked at triggers, so my pseudo
code may or may not be possible.

-Sheeri

On 1/31/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hi, there!
>
> I would like to know whether mysql has built-in capabilities/config options 
> in order to limid a database size or a table size.
> I want a table to grow up to a limit and, when reached, for a new row to be 
> inserted the oldest one be deleted. Has mysql got this
> functionality built-in? If not, what other approaches could I use, triggers 
> ...?
>
> Kinf regards.
>
>
> Prueba el Nuevo Correo Terra; Seguro, RĂ¡pido, Fiable.
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to