Re: Newbie - Primary Keys

2003-10-20 Thread Mark V
u need multiple indexes, or do you need 1 indexwith multiple data fields. At 02:07 PM 10/20/2003, Mark V wrote: Hi Carlos, You can't have 2 primary keys. A table can only have one primary key. You can, however, also define a Unique key, and if you set it up such that it is not null, it will act

Re: Newbie - Primary Keys

2003-10-20 Thread Mark V
rves me correctly, he does not have a specific chapter on DB design or normalization, he does teach good design concepts as you progress through the book and its examples; and for anything else MySQL related, it is, IMHO, the best book out there. Good luck, Mark --- Mark V <[EMAIL PROTECTED]> wrote:

Re: Newbie - Primary Keys

2003-10-20 Thread Mark V
Hi Carlos, You can't have 2 primary keys. A table can only have one primary key. You can, however, also define a Unique key, and if you set it up such that it is not null, it will act much like a prmary key: CREATE TABLE test ( id1 INT UNSIGNED NOT NULL, PRIMARY KEY (id1), id2 INT UNSIG

RE: Starting the mySQL Server

2003-10-20 Thread Mark V
On Windows machines you do not need to init the mysql db as it is pre-initialized. But, if you installed MySQL a directory other than C:\mysql there is additional work that has to be done. You have to create either a C:\my.cnf OR \my.ini file with the following settings (example shows an install in

Re: Getting remote connected machine as value in a select.

2003-10-20 Thread Mark V
FYI, If you only want the hostname, and not the user, combine the USER() with a SUBSTRING_INDEX(): SUBSTRING_INDEX(USER(),'@',-1) --> returns host only SUBSTRING_INDEX(USER(),'@',1) --> returns username only USER(), SESSION_USER(), and SYSTEM_USER() are all synonymous CURRENT_USER() however i

Re: MySQL's 'myslq' database

2003-10-19 Thread Mark V
After modifying user privileges, the new privileges do not take immediate effect. You need to "load" the changes by issuing the following command: FLUSH PRIVILEGES; See the MySQL manual page http://www.mysql.com/doc/en/FLUSH.html#IDX601 for more detail. --- Dan Jones <[EMAIL PROTECTED]> wrote: >

Re: Records w/in 1 week Time Frame

2003-10-19 Thread Mark V
Off the top of my head, I'd say use the DATE_SUB(date,INTERVAL expression type) Function (see manual page http://www.mysql.com/doc/en/Date_and_time_functions.html for details) For example: SELECT * FROM myTable WHERE date_field >= DATE_SUB('2003-10-19', INTERVAL 7 DAY); To get the records for th

Re: Changing LAST_INSERT_ID()/AUTO_INCREMENT()

2003-10-19 Thread Mark V
Hi Jason, For MyISAM tables only, you can manually set the auto increment counter using the syntax: ALTER TABLE table_name AUTO_INCREMENT = 1000 Keep in mind, however, that this does not change the value of the LAST_INSERT_ID() since it still represents the value last inserted. On a freshly crea