Re: Primary key / foreign key question

2008-11-10 Thread Martijn Tonies
Hello Steve, > Ok, I'm a little new a this, so be gentle!! :) > > I was looking into the InnoDB engine for some tables I have, and would like > to use the PK/FK on some of the data. > > It appears that the PK/FK is mainly used for updating/deleting data, > correct? I can't use it to retreive data

Primary key / foreign key question

2008-11-10 Thread Steve Grosz
Ok, I'm a little new a this, so be gentle!! :) I was looking into the InnoDB engine for some tables I have, and would like to use the PK/FK on some of the data. It appears that the PK/FK is mainly used for updating/deleting data, correct? I can't use it to retreive data from multiple tables

Normalization / Foreign Key Question

2008-07-14 Thread Ben A. Hilleli
Hello, A bit embarrassed, I have been away from the databasing side of system development for quite a while so am a little rusty. This seems like a simple issue. I have a USER table: userID fName lName address address2 city province country referrerID userID is the unique pr

Re: duplicate key question

2007-06-23 Thread Steve Edberg
At 10:19 PM -0500 6/22/07, Chris W wrote: when you get a duplicate key error it says something to the effect of "Duplicate entry 'xyz' for key x" What I want to know is how to find out what table fields are part of key x? 'show index' is what you want, I think: http://dev.mysql.com/doc/refma

Re: duplicate key question

2007-06-22 Thread Chris W
mos wrote: Chris, You probably want to know the specific table, so I wonder if it shows up in the MySQL error logs? Of course you can dump the database structure and look for key "x" by doing: mysqldump --no-data --skip-opt --skip-comments --compact and redirect it out to a text file. Ho

Re: duplicate key question

2007-06-22 Thread mos
At 09:19 PM 6/22/2007, you wrote: when you get a duplicate key error it says something to the effect of "Duplicate entry 'xyz' for key x" What I want to know is how to find out what table fields are part of key x? -- Chris, You probably want to know the specific table, so I wonder if it s

"on duplicate key" question

2007-02-28 Thread Lev Lvovsky
This is somewhat related to my last question RE conflicting procedure argument names, but in regards to multi-row inserts... suppose the following procedure: DROP PROCEDURE IF EXISTS sp_ImportedUpdate | CREATE PROCEDURE sp_ImportedUpdate () DETERMINISTIC CONTAINS SQL MODIFIES SQL DATA BEGI

Re: A "key" question

2005-11-18 Thread David Griffiths
eld itself. Regards, Mikhail Berman -Original Message- From: Michael Stassen [mailto:[EMAIL PROTECTED] Sent: Friday, November 18, 2005 12:11 PM To: Mikhail Berman Cc: Jeremy Cole; Jasper Bryant-Greene; mysql@lists.mysql.com Subject: Re: A "key" question Mikhail Berman wrote:

RE: A "key" question

2005-11-18 Thread Mikhail Berman
, November 18, 2005 12:11 PM To: Mikhail Berman Cc: Jeremy Cole; Jasper Bryant-Greene; mysql@lists.mysql.com Subject: Re: A "key" question Mikhail Berman wrote: > Dear Jeremy, > > Thank you for your help. > > I do have an exact situation you have assume I have. Here

Re: A "key" question

2005-11-18 Thread Michael Stassen
Mikhail Berman wrote: Hi Jeremy, This is still "work in progress" but here are some samples of queries we will be running, that involved this table and this date field: == #this fails -- join on is horrible What do you mean by "fails"? Takes too long

Re: A "key" question

2005-11-18 Thread Michael Stassen
Mikhail Berman wrote: Dear Jeremy, Thank you for your help. I do have an exact situation you have assume I have. Here is the output of SHOW CREATE TABLE CREATE TABLE `TICKER_HISTORY_PRICE_DATA` ( `price_data_ticker` char(8) NOT NULL default '', `price_data_date` date NOT NULL default '00

RE: A "key" question

2005-11-18 Thread Mikhail Berman
.mysql.com Subject: Re: A "key" question Hi Mikhail, > Thank you for your help. > > I do have an exact situation you have assume I have. Here is the > output of SHOW CREATE TABLE > > `price_data_ticker` char(8) NOT NULL default '', > `price_data_d

Re: A "key" question

2005-11-18 Thread Jeremy Cole
Hi Mikhail, Thank you for your help. I do have an exact situation you have assume I have. Here is the output of SHOW CREATE TABLE `price_data_ticker` char(8) NOT NULL default '', `price_data_date` date NOT NULL default '-00-00', ... UNIQUE KEY `tidadx` (`price_data_ticker`,`pric

RE: A "key" question

2005-11-18 Thread Mikhail Berman
+ 180 rows in set (0.00 sec) Mikhail Berman -Original Message- From: Jeremy Cole [mailto:[EMAIL PROTECTED] Sent: Thursday, November 17, 2005 5:23 PM To: Mikhail Berman Cc: Jasper Bryant-Greene; mysql@lists.mysql.com Subject: Re: A "k

Re: A "key" question

2005-11-17 Thread Jeremy Cole
Hi Mikhail, I may not have been precise in my question, but the Unique Index in question is a two fields index, and I was looking to find out wisdom from the List if there is sense and/or experience in keying second(left) field on in the Unique Index to speed up a search. If you have a UNIQUE(

Re: A "key" question

2005-11-17 Thread Peter Brawley
Mikhail, >Is it possible or makes sense to key a field that is a part of Unique >Index already? MySQL won't stop you, but it's a waste of space & cpu cycles unless there's a high-priority query performance need for it. PB - Mikhail Berman wrote: Hello everyone, Is it possible or

RE: A "key" question

2005-11-17 Thread Mikhail Berman
bother the List without a good reason and doing what you said before Regards, Mikhail Berman -Original Message- From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] Sent: Thursday, November 17, 2005 4:19 PM To: Mikhail Berman Cc: mysql@lists.mysql.com Subject: Re: A "key" ques

Re: A "key" question

2005-11-17 Thread Jasper Bryant-Greene
Mikhail Berman wrote: Is it possible or makes sense to key a field that is a part of Unique Index already? It's possible, but it doesn't make sense. A unique index is a normal index with an added unique constraint. Adding another index on the same field would make no sense (unless the field

A "key" question

2005-11-17 Thread Mikhail Berman
Hello everyone, Is it possible or makes sense to key a field that is a part of Unique Index already? Regards and thank you Mikhail Berman

Re: Primary Key question

2005-07-01 Thread Haisam K. Ido
0400 From: "Haisam K. Ido" <[EMAIL PROTECTED]> To: mysql@lists.mysql.com Subject: Primary Key question I've created the following table (server 4.1 in win2k) CREATE TABLE `os` ( `id` tinyint(10) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '',

Re: Primary Key question

2005-07-01 Thread Alec . Cawley
"Haisam K. Ido" <[EMAIL PROTECTED]> wrote on 01/07/2005 15:04:01: > > I've created the following table (server 4.1 in win2k) > > CREATE TABLE `os` ( >`id` tinyint(10) NOT NULL auto_increment, >`name` varchar(255) NOT NULL default '', >`description` varchar(255) default NULL, >PRI

Primary Key question

2005-07-01 Thread Haisam K. Ido
I've created the following table (server 4.1 in win2k) CREATE TABLE `os` ( `id` tinyint(10) NOT NULL auto_increment, `name` varchar(255) NOT NULL default '', `description` varchar(255) default NULL, PRIMARY KEY (`id`,`name`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; and was very surprised

Re: Primary Key Question

2005-06-16 Thread Peter Brawley
Hendro, In SQL an empty string is not null. PB Hendro Suryawan wrote: Hi all, I have table with primary key on field PO,BrgId, NOSP but when i try insert several new reccord with field NOSP = '', mysql will accept the new reccord without complaint error. Is this normal behavior? My perception

Re: Primary Key Question

2005-06-16 Thread SGreen
Hendro Suryawan <[EMAIL PROTECTED]> wrote on 06/16/2005 06:53:31 PM: > Hi all, > I have table with primary key on field PO,BrgId, NOSP but when i try > insert several new reccord with field NOSP = '', mysql will accept the > new reccord without complaint error. > Is this normal behavior? As long

Primary Key Question

2005-06-16 Thread Hendro Suryawan
Hi all, I have table with primary key on field PO,BrgId, NOSP but when i try insert several new reccord with field NOSP = '', mysql will accept the new reccord without complaint error. Is this normal behavior? My perception if i have primary key on the three field the three field must be not empty

Foreign Key Question

2004-08-24 Thread Emmett Bishop
Howdy all, Quick question about foreign keys. If I have a database with foreign keys setup, then drop one of the tables (which is referenced by many of the others) and re-add the table, will the existing FKs work? I'm seeing errors in SHOW INNODB STATUS under the LATEST FOREIGN KEY ERRORS section

Unique Key question

2004-08-05 Thread Paul McNeil
Good morning. I have a table with field name DATA type tinytext. The table is already populated. I need DATA to be unique. It seems that MySQL doesn't look at the uniqueness of a field in a binary fashion. Example (chosen because I think it is just plain odd) june = Júne If I query as - Select

Re: Unique Key question

2004-08-05 Thread Michael Stassen
BINARY is for CHAR and VARCHAR, but he's using TINYTEXT. The binary version of TINYTEXT is TINYBLOB. Michael mos wrote: Paul, Just use the "Binary" column attribute to make it case sensitive.. From MySQL Manual: http://dev.mysql.com/doc/mysql/en/CHAR.html As of MySQL 4.1, values in CHAR

Re: Foreign key question

2004-05-14 Thread David Blomstrom
--- Randy Clamons <[EMAIL PROTECTED]> wrote: "Primary key names start with pk_, unique indexes start with uk_, other indexes start wiht ix_." That's a good tip. What if just named the primary key pk and the foreign key fk. Would you run into trouble if you're working with two or three tables, and

RE: Compound Primary Key question

2004-04-24 Thread Matt Chatterley
olumn as a PK. Cheers, Matt > -Original Message- > From: Jeremy Zawodny [mailto:[EMAIL PROTECTED] > Sent: 23 April 2004 23:51 > To: Emmett Bishop > Cc: [EMAIL PROTECTED] > Subject: Re: Compound Primary Key question > > On Fri, Apr 23, 2004 at 03:40:43PM -0700, E

Re: Compound Primary Key question

2004-04-23 Thread Jeremy Zawodny
On Fri, Apr 23, 2004 at 03:40:43PM -0700, Emmett Bishop wrote: > Quick question. In general, is it better to create > compound primary keys or use an auto increment field > to uniquely identify each record? Yes. It depends on your application and your data. Jeremy -- Jeremy D. Zawodny | Pe

Compound Primary Key question

2004-04-23 Thread Emmett Bishop
Quick question. In general, is it better to create compound primary keys or use an auto increment field to uniquely identify each record? --T __ Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ http://photos.yahoo.c

Re: Primary key question

2002-12-17 Thread Steve Yates
On Tue, 17 Dec 2002 19:15:08 +0100, Serrand Patrice wrote: >Does MySQL automatically create index on primary key ? Yes. See http://www.mysql.com/doc/en/CREATE_TABLE.html - Steve Yates - Antonym: The opposite of the word you're searching for. ~ Taglines by Taglinator - www.srtware.com ~ ---

Primary key question

2002-12-17 Thread Serrand Patrice
Hi, Does MySQL automatically create index on primary key ? If not how can I create an index on a primary key ? Thanks for any help. Patrice Serrand - Before posting, please check: http://www.mysql.com/manual.php (the manu

re: Primary Key Question

2002-12-16 Thread Victoria Reznichenko
On Monday 16 December 2002 18:12, tmb wrote: > I understood that MySQL didn't internally keep up with > the relationships between tables... like MS Access... > > And that it was up to the programmer to referential > integrity... > > But I noticed in phpMyAdmin that the offer the option > of definin

Primary Key Question

2002-12-16 Thread tmb
I understood that MySQL didn't internally keep up with the relationships between tables... like MS Access... And that it was up to the programmer to referential integrity... But I noticed in phpMyAdmin that the offer the option of defining a column in a table as 'Primary' Am I confused on this

RE: mysql primary key question!

2002-07-09 Thread Erick Papadakis
uld be great if you'd post it > to > the mysql list. > > Carl McNamee > Systems Administrator > Billing Concepts > (210) 949-7282 > > -----Original Message- > From: Erick Papadakis [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 08, 2002 6:30 AM > To:

Re: mysql primary key question!

2002-07-08 Thread Roger Baklund
* Erick Papadakis > i need to set up an auto_increment field inside mysql. for various > reasons, the maximum size is 3. Could you say something about these reasons...? > but i don't want this to be ONLY integers > because that limits me until 999 numbers only. Well... using three _bytes_, the

Re: mysql primary key question!

2002-07-08 Thread cristian ditoiu
n . - Original Message - From: "Erick Papadakis" <[EMAIL PROTECTED]> To: "mysql" <[EMAIL PROTECTED]> Sent: Monday, July 08, 2002 2:30 PM Subject: mysql primary key question! > hello, > > i hope some database guru can help me with this! > >

Re: mysql primary key question!

2002-07-08 Thread Gelu Gogancea
t e-mail address : [EMAIL PROTECTED] [EMAIL PROTECTED] - Original Message - From: "Erick Papadakis" <[EMAIL PROTECTED]> To: "mysql" <[EMAIL PROTECTED]> Sent: Monday, July 08, 2002 2:30 PM Subject: mysql primary key question! > hello, > &

mysql primary key question!

2002-07-08 Thread Erick Papadakis
hello, i hope some database guru can help me with this! i need to set up an auto_increment field inside mysql. for various reasons, the maximum size is 3. but i don't want this to be ONLY integers because that limits me until 999 numbers only. since i have all flexibility for these three digi

Foreign Key Question

2002-06-14 Thread Michael Ivanyo
I am using MySql-3.23.51. Even though this version doesn't support foreign keys, the foreign key declarations can be entered without getting an error message. I would like to write CREATE TABLE statements that include foreign key declarations that would be compatible with future releases that wi

Re: key question

2001-10-31 Thread Jeremy Zawodny
On Wed, Oct 31, 2001 at 10:49:12PM +, Federico Schwindt wrote: > > thanks for the reply. it seems to be clear now. > > > MySQL Doesn't allow you to specifiy which index to use - it chooses > > (sometimes badly) whether or not to use one. > > From documentation: > > As of MySQL Versi

Re: key question

2001-10-31 Thread Federico Schwindt
Rick Emery wrote: > > First: I believe this is not legal (looking at myySQL manual p 6.5.3): > PRIMARY KEY (key1), KEY (key2) > You may use one or the other. yup, it does work here, ver 3.23.42. > Second: You may search by either owner_id or customer_id without creating an > index. > Such as

Re: key question

2001-10-31 Thread Federico Schwindt
thanks for the reply. it seems to be clear now. > MySQL Doesn't allow you to specifiy which index to use - it chooses > (sometimes badly) whether or not to use one. From documentation: As of MySQL Version 3.23.12, you can give hints about which index MySQL should use when retrieving i

Re: key question

2001-10-31 Thread Bill Adams
Federico Schwindt wrote: > hi, > > i'm not sure if this belongs here, but i cannot seem to find the > answer anywhere else. > first, what's the difference between: > > PRIMARY KEY (key1, key2) > PRIMARY KEY (key1), KEY (key2) The first line creates a single, unique key on the columns key

RE: key question

2001-10-31 Thread Quentin Bennett
badly) whether or not to use one. Hope this helps. Quentin -Original Message- From: Federico Schwindt [mailto:[EMAIL PROTECTED]] Sent: Thursday, 1 November 2001 10:57 a.m. To: [EMAIL PROTECTED] Subject: key question hi, i'm not sure if this belongs here, but i cannot seem to find

Re: key question

2001-10-31 Thread Paul DuBois
At 9:57 PM + 10/31/01, Federico Schwindt wrote: >hi, > > i'm not sure if this belongs here, but i cannot seem to find the >answer anywhere else. > first, what's the difference between: > > PRIMARY KEY (key1, key2) This creates an index within which pairs of key1/key2 values are unique.

RE: key question

2001-10-31 Thread Rick Emery
- From: Federico Schwindt [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 31, 2001 3:57 PM To: [EMAIL PROTECTED] Subject: key question hi, i'm not sure if this belongs here, but i cannot seem to find the answer anywhere else. first, what's the difference between: PRIMARY KEY (

key question

2001-10-31 Thread Federico Schwindt
hi, i'm not sure if this belongs here, but i cannot seem to find the answer anywhere else. first, what's the difference between: PRIMARY KEY (key1, key2) PRIMARY KEY (key1), KEY (key2) second, let's suppose the following table: owner_id int(11), customer_id int(11), customer_in

Re: SQL PRIMARY KEY question

2001-02-17 Thread Fred van Engen
On Sat, Feb 17, 2001 at 12:07:53PM +0100, Cedric Lefebvre wrote: > I have written the following SQL request, but I get > an error, why ? > > create table MovementOrder ( > teamCode INT(4) NOT NULL, > quarter INT(4) NOT NULL, > position INT(4) NOT NULL, > priority INT(4) NOT NULL, > orde

Re: SQL PRIMARY KEY question

2001-02-17 Thread Artem Koutchine
- From: "Cedric Lefebvre" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, February 17, 2001 2:07 PM Subject: SQL PRIMARY KEY question > I have written the following SQL request, but I get > an error, why ? > > create table MovementOrder ( > t

SQL PRIMARY KEY question

2001-02-17 Thread Cedric Lefebvre
I have written the following SQL request, but I get an error, why ? create table MovementOrder ( teamCode INT(4) NOT NULL, quarter INT(4) NOT NULL, position INT(4) NOT NULL, priority INT(4) NOT NULL, order VARCHAR(10), parameter VARCHAR(5), PRIMARY KEY(teamCode,quarter,position,prio