Regular Expressions in MySQL -- how to show addresses that have the same numbers?

2008-03-08 Thread Joshua Beall
Hi All, We've got a database (legacy, running MySQL 4.1.22 Standard) of constituents. We want to search through it for duplicates, and I've found that a good way to generate a list of potential duplicate addresses is to look for addresses that have matching street numbers, zipcodes, and last nam

Re: Left join results - can we make it produce at most 1 row?

2005-02-17 Thread Joshua Beall
"Wolfram Kraus" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Use GROUP BY with GROUP_CONCAT: > http://dev.mysql.com/doc/mysql/en/group-by-functions.html Thanks, I'll take a look and see if I can figure that out. I wasn't aware of the GROUP_CONCAT function; it looks like that

Left join results - can we make it produce at most 1 row?

2005-02-17 Thread Joshua Beall
Hi All, I have two tables in a children's program registration system, parent and child. 1 row in the parent table corresponds to 1 or more rows in the child table. Right now, when I do SELECT * FROM parent LEFT JOIN child ON parent.ID = child.parentID I get multiple rows for each parent if

Re: Difference between 'LIKE' and '='

2005-02-08 Thread Joshua Beall
stname Smith and Smithers and Smithereens, etc. I'm aware of security concerns like SQL injection and so forth and am handling them, but I've omitted all that code for the sake of brevity. No need to warn me about all that. -jb "Joshua Beall" <[EMAIL PROTECTED]&g

Difference between 'LIKE' and '='

2005-02-08 Thread Joshua Beall
Hi All, >From what I understand the LIKE keyword allows you to do things like include wildcards and match against regular expressions. But I have a question: is there any difference between the following? SELECT lname, fname FROM contacts WHERE lname = 'smith'; SELECT lname, fname FROM contacts

RE: Clustering and a large database

2004-12-06 Thread Joshua Beall
> -Original Message- > From: John McCaskey [mailto:[EMAIL PROTECTED] > Sent: Monday, December 06, 2004 17:01 > To: Joshua Beall > Cc: [EMAIL PROTECTED] > Subject: Re: Clustering and a large database > > > Yes, mysql clustering is a ram only database. It does

Re: Clustering and a large database

2004-12-06 Thread Joshua Beall
"Klaus Berkling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have started to import our data. I gather from the manual that tables > are stored in RAM. I am trying to import a database with 11 tables with > about 7 million rows. If I follow the math in the manual, one row

RE: Selecting a random row

2004-12-06 Thread Joshua Beall
> How many rows do you anticipate that the table will have? Have you > tested this on your server? I would have to bet that if you > have only a few K rows that speed/performance will not be an issue. I doubt I will have more than 100. Perhaps I shouldn't worry about it, then. > The way to > en

Selecting a random row

2004-12-06 Thread Joshua Beall
Hi All, I understand that I can get a random row out of a table by doing something like SELECT * FROM fortunes ORDER BY RAND() LIMIT 1 But I have also been told that this is a very slow operation. I am building a script that will display a random saying, user testimonial, whatever, on a web p

Searching a table and replacing all instances of a string with another

2004-11-12 Thread Joshua Beall
Hi All, I would like to search through all fields in a table, and anytime a search string comes up, have it replace it with another string. By way of example, let's say I wanted to replace every occurence of 'Peter' with 'Paul' - can I do this purely with SQL? I know I could do it in PHP fair

Maximum row size for MyISAM table type

2004-11-11 Thread Joshua Beall
Hi All, I am a bit confused by the MySQL documentation on this subject. From http://dev.mysql.com/doc/mysql/en/Storage_requirements.html "The maximum size of a row in a MyISAM table is 65,534 bytes. Each BLOB and TEXT column accounts for only five to nine bytes toward this size." So, the maxi

Checking the status of a field, and ensuring it is not updated before I change it

2004-11-11 Thread Joshua Beall
Hi All, I have the following situation: I want to check a row in a database (list of jobs that need to be run). So, my script checks the status field, and if it is not started, then it marks it as locked and running, and when it finishes, it marks it as completed. Now, here is what I am concerne

Meaning of 1:1, 1:1 generalization, 1:n, 1:n non identifying, n:m

2004-09-30 Thread Joshua Beall
Hi All, I've been taking a look at DB Designer 4, and looking through the documentation (http://www.fabforce.net/dbdesigner4/doc/index.html) I am a little unclear on some of their nomenclature: '1:1' - Ok, one to one. Got it. '1:1' generalization - Don't know this. Obviously different somehow

Graphical program to describe table relationships

2004-09-30 Thread Joshua Beall
Hi All, This is more of a general SQL database question than a MySQL question, but since I use MySQL almost exclusively I thought I would ask here. Up until now, when designing a database, I always plotted out the relationships on paper, with pen/pencil. I've filled large pieces of paper with al

Re: Calculated fields - is there any way to do this?

2004-08-20 Thread Joshua Beall
MySQL 4.0.20-standard, but willing to upgrade if I have to -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Calculated fields - is there any way to do this?

2004-08-20 Thread Joshua Beall
Is there any way in MySQL to have calculated fields? E.g., a make "expiration" equal to the "lastPaid" date, plus 1 year. Whenever lastPaid gets updated, expiration can be updated as well. Is this possible? I know it could be implemented client side, but I am wondering if it could be done direc

What is the difference between creating one key with multiple fields, and creating multiple keys, one per field?

2004-06-25 Thread Joshua Beall
Hi All, I have noticed that in phpMyAdmin, when I create a table and select the columns I want indexed, if I select two or more columns (say "fname" and "lname") to be indexed, then when the table is created, instead of two keys, I have only one key, and it contains both the fname and lname column

Re: Automatically optimizing a table - how should I so this?

2004-05-16 Thread Joshua Beall
"Per Andreas Buer" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > "Joshua Beall" <[EMAIL PROTECTED]> writes: > > > "Daniel Kasak" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > >> Is there

Re: Automatically optimizing a table - how should I so this?

2004-05-15 Thread Joshua Beall
"Daniel Kasak" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there any particular reason why you think the table will need > optimizing, or do you just want everything to be super-optimized? Because when I pull up phpMyAdmin, and it says there is 3,768 bytes of overhead, I just

Automatically optimizing a table - how should I so this?

2004-05-15 Thread Joshua Beall
Hi All, Is there a way to automatically optimize a table anytime data is changed. I have a table that only has changes made to it occasionally (average over a 1 week period is probably 1 row is updated each day), and I would like it to automatically optimize the table, rather than having to do it

Re: Integers - How would you enter 112,249?

2004-05-14 Thread Joshua Beall
"David Blomstrom" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > When I try to import my csv file in MySQL-Front, it > appears to get hung up on every integer - or perhaps > it's just every integer in the first integer field. > > When it cites an error, it only lists the numerals > a

"table marked as crashed", then repaired by "check"?

2004-05-14 Thread Joshua Beall
Hi All, MySQL 4.0.18-standard on RHEL3, 2.4.21-15.ELsmp kernel. I have a table on one a moderate traffic site, and yesterday I had my client notify me that some of the pages were not working. Note that most of the page content is stored in a table called "pageContent". Now, about half the page

Dumping MySQL result set to a spreadsheet

2004-02-29 Thread Joshua Beall
Hi All, I am wondering if anyone can point me to a utility that will let me dump the result of a MySQL query to a file I can open in MS Excel or (preferably) OpenOffice.org Calc. phpMyAdmin lets you do this if you want to dump a "SELECT * FROM ", but if I want to fine tune it I cannot (unless I a