Is it possible to either update or insert in a single query?

2007-04-13 Thread Douglas Pearson
Apologies if this is a dumb question, but is it possible to write a single query that either updates certain columns in a row, or adds an entirely new row if there is none already? I seem to be running into this a lot, and so far I've solved it by: 1) run UPDATE table SET x,y WHERE some row 2) if

Re: Is it possible to either update or insert in a single query?

2007-04-13 Thread Carlos Proal
Have you look at replace ? http://dev.mysql.com/doc/refman/5.0/en/replace.html Carlos Douglas Pearson wrote: Apologies if this is a dumb question, but is it possible to write a single query that either updates certain columns in a row, or adds an entirely new row if there is none already? I

Re: key_buffer_size and InnoDB tables

2007-04-13 Thread Ding Deng
Jim [EMAIL PROTECTED] writes: On the following page and in the example ini files installed with MySQL it's suggested that key_buffer_size is an option that affects MyISAM performance. http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html But on the following page about tuning

Re: can't import

2007-04-13 Thread Thufir
Mogens Melander mogens at fumlersoft.dk writes: Hmmm, your LINES TERMINATED BY '/r/n'; should be: LINES TERMINATED BY '\r\n'; if the abc.txt file was generated on windows. If it was made on *nix/linux, it should be: LINES TERMINATED BY '\n'; I think I fixed it, at least as best I

Re: can't import

2007-04-13 Thread Chris
I think I fixed it, at least as best I could. still same result: [EMAIL PROTECTED] ~]$ [EMAIL PROTECTED] ~]$ [EMAIL PROTECTED] ~]$ su - mysql Password: -bash-3.1$ -bash-3.1$ mysql -u root -p snip mysql quit Bye -bash-3.1$ exit logout No no no. AS the MYSQL user: cat /tmp/abc.txt

SQL restore deleted records

2007-04-13 Thread Andrey Kotrekhov
SQL Hello, All. There is a problem. Ones many records from MyISAM table are deleted. Nobody change this table after this. The records have variable length. How can I restore it? The table format isn't well described in manual, as for me. Best regards.

Re: SQL restore deleted records

2007-04-13 Thread asv
SQL Hello, All. There is a problem. Ones many records from MyISAM table are deleted. Nobody change this table after this. The records have variable length. How can I restore it? The table format isn't well described in manual, as for me. is not it possible to recover data from mysql

RE: SQL restore deleted records

2007-04-13 Thread Mikhail Berman
I do not have a Russian keyboard here to respond to you in Russian, but maybe you could describe a problem in Russian. I am not sure what happened Mikhail -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 4:17 AM To: [EMAIL PROTECTED]

Re: SQL restore deleted records

2007-04-13 Thread Andrey Kotrekhov
Добрый день. SQL Hello, All. There is a problem. Ones many records from MyISAM table are deleted. Nobody change this table after this. The records have variable length. How can I restore it? The table format isn't well described in manual, as for me. is not it possible to recover data from

Re: Is it possible to either update or insert in a single query?

2007-04-13 Thread Mogens Melander
This part of the manual might be of use to you: REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name [(col_name,...)] VALUES ({expr | DEFAULT},...),(...),... Or: REPLACE [LOW_PRIORITY | DELAYED] [INTO] tbl_name SET col_name={expr | DEFAULT}, ... Or: REPLACE [LOW_PRIORITY |

Guru Bar, DotOrg Pavilion, BOFs and Keynotes at MySQL Conference Expo 23-26 April 2007

2007-04-13 Thread Kaj Arnö
Dear MySQL Users, Sorry for spamming the [EMAIL PROTECTED] list with several identical messages a month ago. My mistake. *This* should be just *one* message! Meet the top MySQL experts at the Guru Bar and in the Birds of a Feather sessions! Talk to the key FOSS developers at the DotOrg

Re: can't import

2007-04-13 Thread Mogens Melander
Hmmm, i got a somewhat different result :^) (BTW. I'm on Slackware 10.0. What are you on?) $ cat /tmp/abc.txt A1, B1, C1 A2, B2, C2 A3, B3, C3 $mysql test Server version: 5.0.24a-log mysql SHOW GRANTS FOR ''@localhost; +--+ | Grants for @localhost

Re: Is it possible to either update or insert in a single query?

2007-04-13 Thread Martijn Tonies
REPLACE is a MySQL extension to the SQL standard. It either inserts, or deletes and inserts. For another MySQL extension to standard SQL — that either inserts or updates — see Section 13.2.4.3, “INSERT ... ON DUPLICATE KEY UPDATE Syntax”. Take note!! If you're using triggers, foreign key

Re: can't import

2007-04-13 Thread Thufir
I think I got it: pasty / paste.husk.org This content is stored as http://paste.husk.org/8089. From: Someone at 24.84.131.197 Summary: -bash-3.1$ -bash-3.1$ -bash-3. -bash-3.1$ -bash-3.1$ -bash-3.1$ whoami mysql -bash-3.1$ ls -al /tmp/abc.txt -rw-r--r-- 1 mysql mysql 27 Apr 13 11:36

Could query muti sql?

2007-04-13 Thread wang shuming
Hi, Could query multi SQLs in a query? How? Thanks ! Shuming Wang

Re: Could query muti sql?

2007-04-13 Thread asv
Hi, Could query multi SQLs in a query? How? select x,y,z from foo union select x,y,z from boo; -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

problem with Procedure and Cursor

2007-04-13 Thread balaraju mandala
Hi all, I am getting problem with this Procedure, i am reading the values using a cursor, and appending them to variable. but i am getting null as output. Can anybody please tell where is the wrong. create procedure activity1() begin declare done int default 0; declare pack text; declare name,

Re: Why Is Autonumber Not Working With Following Query

2007-04-13 Thread Brent Baisley
You probably should specify the fields for the insert. MySQL is probably inserting into the ID field because you didn't specify which fields to use for inclusion. INSERT INTO jobs (field1,field2,...) (SELECT...) - Original Message - From: John Kopanas [EMAIL PROTECTED] To: [EMAIL

RE: Is it possible to either update or insert in a single query?

2007-04-13 Thread Price, Randall
You could try a stored procedure that either inserts a new row or updates an existing row: CREATE PROCEUDRE InsertOrUpdateRecord(IN NewID INT, ... other params ... ) BEGIN IF NOT EXISTS (SELECT ID FROM myTable WHERE ID = NewID) THEN BEGIN INSERT INTO myTable () END; ELSE

How to overwrite existing file with SELECT .. INTO?

2007-04-13 Thread Amer Neely
I'm using MySQL 5.0.21 and am trying to find out if it is possible to overwrite an existing file when using a 'SELECT ... INTO' command from the command line. Is there another parameter that can do this? I've looked through the online reference manual, but found no specific help there. --

Survey: Slow Computers and Developer Productivity

2007-04-13 Thread Behrang Saeedzadeh
Hi, I have created a survey titled Slow Computers and Developer Productivity with the aim of finding the possible effects of slow computer performance on developer productivity, behavior, and ROI for companies. It is a small survey with only 5 items. I have created this experimental survey for

Slow Computers and Developer (oops... the link was missing)

2007-04-13 Thread Behrang Saeedzadeh
Hi, I have created a survey titled Slow Computers and Developer Productivity with the aim of finding the possible effects of slow computer performance on developer productivity, behavior, and ROI for companies. It is a small survey with only 5 items. I have created this experimental survey for

RE: Is it possible to either update or insert in a single query?

2007-04-13 Thread Douglas Pearson
Thanks Mogens. I was aware of REPLACE but it was the non-standard ON DUPLICATE KEY UPDATE that I was looking for. Thanks, Doug -Original Message- From: Mogens Melander [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 2:28 AM To: Douglas Pearson Cc: [EMAIL PROTECTED] Subject: Re:

Re: Mysql Hogging all system resources

2007-04-13 Thread Chuck Swiger
On Apr 12, 2007, at 1:17 PM, Don O'Neil wrote: [ ... ] Is there a way to prioritize or set the amount of resources that MySQL is allowed to have? Do I need to set it up as a jailed process maybe? I've never done that before, so I'm not sure if it's the right approach or not. Um, didn't

Re: replication?

2007-04-13 Thread Saira
Hello i just want to ask which type of replication is suitable for SQL servers when enviornment is online and all system is related to the university database with centralised database please help me out . -- View this message in context:

import rss feed into mysql

2007-04-13 Thread Thufir
what would be the quickest, easiest way to import, for example, the rss feed http://rss.gmane.org/gmane.comp.db.mysql.general into mysql? what would be some different approaches, pls? I'm more interested in craigslist stuff, but the above is a good example, I think. thanks, Thufir -- MySQL

Re: import rss feed into mysql

2007-04-13 Thread Ryan Stille
Perl would be my language of choice to do something like this. -Ryan Thufir wrote: what would be the quickest, easiest way to import, for example, the rss feed http://rss.gmane.org/gmane.comp.db.mysql.general into mysql? what would be some different approaches, pls? I'm more interested in

creating a function in mysql

2007-04-13 Thread Andrey Dmitriev
All, I've been trying to create a function that will generate URLs so that I wouldn't have to wrote ugly SQL all the time. After no success, I've determined that I don't seem to be able to create functions at all. I am relatively new to mysql development (or management), so any advice is

Re: creating a function in mysql

2007-04-13 Thread Peter Brawley
I've determined that I don't seem to be able to create functions at all. Declare a delimiter, and lose the quote around the function name, eg DROP FUNCTION IF EXISTS weighted_average; DELIMITER | CREATE FUNCTION weighted_average(n1 INT, n2 INT, n3 INT, n4 INT) RETURNS int(11) DETERMINISTIC

RE: Mysql Hogging all system resources

2007-04-13 Thread Don O'Neil
Is there a way to set a 'nice' priority for a particular user? Also, when I run this: nice -n 5 /usr/bin/spamd -d -c -m 5 I get: nice: Badly formed number. I ran a man page on it, and this is the right format, but its not working. -Original Message- From: Chuck Swiger

RE: Mysql Hogging all system resources

2007-04-13 Thread Don O'Neil
Nevermind on the badly formatted number... I specified the full path /usr/bin/nice and it worked ok this time :-) However, I still want to know if there is a way to specify a nice level for an entire users processes. Thanks! -Original Message- From: Don O'Neil [mailto:[EMAIL PROTECTED]

Re: Mysql Hogging all system resources

2007-04-13 Thread Chuck Swiger
On Apr 13, 2007, at 2:40 PM, Don O'Neil wrote: Is there a way to set a 'nice' priority for a particular user? Why, yes-- see /etc/login.conf and the priority keyword. Some shells also let you adjust the priority levels for various users. Also, when I run this: nice -n 5 /usr/bin/spamd -d -c

RE: Mysql Hogging all system resources

2007-04-13 Thread Andrey Dmitriev
Perhaps a better solution is to determine why mysql is 'hogging' resources in the first place. There is a tuning section in MySQL manual. -a -Original Message- From: Chuck Swiger [mailto:[EMAIL PROTECTED] Sent: Friday, April 13, 2007 5:46 PM To: Don O'Neil Cc: [EMAIL PROTECTED];

Re: Mysql Hogging all system resources

2007-04-13 Thread Dan Nelson
In the last episode (Apr 13), Don O'Neil said: Nevermind on the badly formatted number... I specified the full path /usr/bin/nice and it worked ok this time :-) However, I still want to know if there is a way to specify a nice level for an entire users processes. If you create a login class

Re: import rss feed into mysql

2007-04-13 Thread Thufir
Ryan Stille ryan at cfwebtools.com writes: Perl would be my language of choice to do something like this. -Ryan what about http://paperboy.sourceforge.net/? thanks, Thufir -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

RE: creating a function in mysql

2007-04-13 Thread Andrey Dmitriev
Thanks, that works.. Next question Does MySql support using it's own functions within this code? E.g. I tried set str = select concat (str,'hello'); set str = concat (str, 'hello'); And it didn't seem to like either. Thanks, -andrey _ From: Peter Brawley [mailto:[EMAIL

how to tell if something hasn't happened yet

2007-04-13 Thread Jay Blanchard
Good day gurus and gurettes! I have a table; | transactionid | int(11) | NO | PRI | | auto_increment | | username | varchar(32) | NO | | || | storeid | varchar(6) | NO | | || | action| int(4) | NO

RE: how to tell if something hasn't happened yet

2007-04-13 Thread Andrey Dmitriev
It depends on what's in the datetime column. http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html Something like this: select store.storeid, store.stName from store left outer join transaction on(store.storeid = transaction.storeid) where transaction.created IS NULL and

Re: creating a function in mysql

2007-04-13 Thread Peter Brawley
Does MySql support using it's own functions within this code?DROP FUNCTION IF EXISTS testconcat; Works for me (though CONCAT maddenly trims its args): DELIMITER | CREATE FUNCTION testconcat( str CHAR(20) ) RETURNS CHAR(50) DETERMINISTIC BEGIN SET str = CONCAT( str, ' ', 'suffix' ); RETURN

Re: how to tell if something hasn't happened yet

2007-04-13 Thread Mogens Melander
How about this: select s.* from store s where s.id not in (select t.storeid from trans t where t.created=date(now())); -- Later Mogens Melander +45 40 85 71 38 +66 870 133 224 On Sat, April 14, 2007 00:22, Jay Blanchard wrote: Good day gurus and gurettes! I have a table; |

Re: creating a function in mysql

2007-04-13 Thread Baron Schwartz
Andrey Dmitriev wrote: Thanks, that works.. Next question Does MySql support using it's own functions within this code? E.g. I tried set str = select concat (str,'hello'); set str = concat (str, 'hello'); And it didn't seem to like either. Eliminate the spaces between the function

Queries start off fast, then crawl

2007-04-13 Thread mos
I have a Windows program that will execute simple 1 table queries that use an index and sort, and with a limit of 20 rows. When I start the program for the first time, the queries run quite fast at around 1200 queries/second. Then within a couple of seconds it drops immediately down to 20-40

Could query muti sql?

2007-04-13 Thread wang shuming
For example: Query(update a1 ... ; insert into ...; ...) Regards! Shuming Wang

a little user rights help?

2007-04-13 Thread Denise Wilson
Hi. I'm brand new at this so I'm looking for a little help. I need to have two difference levels of access to a mysql database that I am developing for our librarians to use to maintain the various research resources we have available in our library. AdminType1 should have Delete, Insert,

RE: MySQL slave error when creating view

2007-04-13 Thread Tim Lucia
Nobody has any idea(s) on this? -Original Message- From: Tim Lucia [mailto:[EMAIL PROTECTED] Sent: Friday, April 06, 2007 7:11 PM To: [EMAIL PROTECTED] Subject: MySQL slave error when creating view I ran the following DDL on our master today: CREATE OR REPLACE VIEW

Re: a little user rights help?

2007-04-13 Thread Mogens Melander
Well, that look like a simple way to achieve your goal. connect to db as AdminTyp2, get usercredentials (select), reconnect with users AdminType. Normaly i handle stuff like that in the application. No need to display a delete button, if the action will fail anyway (with an ugly mysql error).

RE: Mysql Hogging all system resources

2007-04-13 Thread Don O'Neil
I did this: In my login.conf file (assuming that all you have to do is change whatever you don't want to be the default): nice:\ :priority=5: In the user entry I put 'nice' in field 5. When I rebuilt the login.conf db, nothing seems to have changed for th user... A 'top' still shows