Re: select by weekly SUM

2003-07-13 Thread Veysel Harun Sahin
SELECT week, sum(tips) FROM mytable GROUP BY week; [EMAIL PROTECTED] wrote: I have a table of daily information (tips, # of deliveries, etc.). Does anyone know of an easy way using SQL to extract all weekly sums of a field? Like: week 1: sum of tips for that week week 2: sum of tips for that

query: if exists UPDATE else INSERT?

2003-07-13 Thread Alexander Newald
Hello, I'm looking for a solution to write a sql query that inserts a set of data if the data id is not present and otherwise update the set. I have a table with id (char(8)) and value (int(8)) To make my problem clear: There is no set with id = 20030713 insert into table values (20030713,10

Re: query: if exists UPDATE else INSERT?

2003-07-13 Thread Veysel Harun Sahin
Try this: set @w = 0; select @w := value from table where id = 20030713; delete from table where id = 20030713; insert into table values (20030713, @w + 20); [EMAIL PROTECTED] wrote: Hello, I'm looking for a solution to write a sql query that inserts a set of data if the data id

1 where OR query with indexes or 2 queries

2003-07-13 Thread Yann GAUTHERON
Hi, ID_LOGIN is an integer Can anyone say me if this : WHERE index1=ID_LOGIN OR index2=ID_LOGIN must be slower than those 2 queries : WHERE index1=ID_LOGIN WHERE index2=ID_LOGIN for a 20 000 rows table ? Thanks for reading. Abalam -- MySQL General Mailing List For list archives:

Re: select by weekly SUM

2003-07-13 Thread Trevor Smith
On Sun, 13 Jul 2003 11:03:21 +0300, Veysel Harun Sahin wrote: SELECT week, sum(tips) FROM mytable GROUP BY week; Sorry, I wasn't clear. I have ONLY daily data, not weekly, but I want to output weekly data. These are the fields I have: date DATE NOT NULL, hours_worked DECIMAL(5,2),

Re: select by weekly SUM

2003-07-13 Thread Veysel Harun Sahin
Then you can use the week function of mysql in group by clause like this: SELECT sum(tips) FROM mytable GROUP BY WEEK(date); This will group your records week by week then will sum each week's tips. Also you can look at http://www.mysql.com/doc/en/Date_and_time_functions.html for the date and

Re: query: if exists UPDATE else INSERT?

2003-07-13 Thread Paul Chvostek
solutions were described in that thread. I have a table with id (char(8)) and value (int(8)) To make my problem clear: There is no set with id = 20030713 insert into table values (20030713,10); The next set is (20030713,20) but as a set with 20030713 is already available I like to have

Re: query: if exists UPDATE else INSERT?

2003-07-13 Thread Paul Chvostek
is the fact that you can: mysql UPDATE table SET value=value+10 WHERE id='20030713'; as long as the record exists. And as long as you can check for success or failure of your UPDATE, you can determine whether you should run an INSERT to load an original record with this id. -- Paul Chvostek

utf8 support

2003-07-13 Thread Sagi Bashari
Hello, I would like to know the status of the UTF8 support in MySQL 4.1. I tried to create a table using utf8 charset, and inserting hebrew text into it. it seems like it still treats this text as binary - for example the length() function returns 8 on 4 chars string, or when cretting a

simple group by taking way too long..

2003-07-13 Thread Henry Hank
I have the following SQL. The source table has 8.1 million rows, and the resulting table will have about 7.9 million rows. I know that's not much of a decrease, but the logic is correct as I've tested it on smaller sets. The problem is that when I run with the full set of 8 million rows, it

Re: simple group by taking way too long..

2003-07-13 Thread Justin Spies
Henry, The information you've posted is a good start, can you post the results of an EXPLAIN command? That would go a long way towards finding a solution. --Justin On Sun, 13 Jul 2003, Henry Hank wrote: I have the following SQL. The source table has 8.1 million rows, and the resulting

Re: simple group by taking way too long..

2003-07-13 Thread Henry Hank
The explain plan isn't anything I wouldn't ordinarily expect - a full table scan: +---+--+---+--+-+--+-+-+ | table | type | possible_keys | key | key_len | ref | rows| Extra |

Storage efficiency of VARCHARs

2003-07-13 Thread Dan Anderson
I am curious about the internal representation of VARCHARS. I cannot find any documentation on it in the mySQL manual. Will a VARCHAR(10) take up less space then a VARCHAR(80), even though they are variable? Thanks in advance, Dan -- MySQL General Mailing List For list archives:

does mySQL support a boolean data type?

2003-07-13 Thread Dan Anderson
I ran a search through the mySQL manual and google and could not find a satisfactory answer. Does mySQL support the declaration of a boolean data type? Currently I am using VARCHAR(6)s with either 'TRUE' or 'FALSE' and would like to cut down on the storage. Thanks in advance, Dan Anderson --

derived tables

2003-07-13 Thread Shawn McGinn
I would like to select data from a table where the table name is located in another table, and I am using the following query: select t1.* from (select tbl_name from user_table where user=guy) t1; This should return the data fom table 'tbl_name', but I only get results from the subquery (ie. the

derived tables

2003-07-13 Thread Shawn McGinn
I would like to select data from a table where the table name is located in another table, and I am using the following query: select t1.* from (select tbl_name from user_table where user=guy) t1; This should return the data from table 'tbl_name', but I only get results from the subquery (ie.

Re: does mySQL support a boolean data type?

2003-07-13 Thread nospam
why don't you use int(1) and set it to 0 or 1? -yves -Ursprngliche Nachricht- Von: Dan Anderson [EMAIL PROTECTED] An: [EMAIL PROTECTED] Gesendet: Sonntag, 13. Juli 2003 18:41 Betreff: does mySQL support a boolean data type? I ran a search through the mySQL manual and google and

Re: does mySQL support a boolean data type?

2003-07-13 Thread Ed Leafe
On Sunday, July 13, 2003, at 12:41 PM, Dan Anderson wrote: I ran a search through the mySQL manual and google and could not find a satisfactory answer. Does mySQL support the declaration of a boolean data type? Currently I am using VARCHAR(6)s with either 'TRUE' or 'FALSE' and would like to

Re: does mySQL support a boolean data type?

2003-07-13 Thread Sagi Bashari
Use unsigned tinyint(1) with 1 and 0 as values. On 13/07/2003 19:41, Dan Anderson wrote: I ran a search through the mySQL manual and google and could not find a satisfactory answer. Does mySQL support the declaration of a boolean data type? Currently I am using VARCHAR(6)s with either 'TRUE'

Re: does mySQL support a boolean data type?

2003-07-13 Thread Dan Anderson
why don't you use int(1) and set it to 0 or 1? Storage space is an issue because I am designing a very large database for a client. Every byte I save per row will translate into many many megs. So if all I need is a single bit for true or false I want to get as close to that single bit as

Re: derived tables

2003-07-13 Thread Dan Anderson
Are you trying to do this within a programming language? I use similar queries using PHP and have no problem. Although I would write my query like: SELECT tbl_name FROM user_table WHERE user = 'guy'; And then use the result to run a select, update, insert, or whatever -Dan On Sun, 2003-07-13

Re: does mySQL support a boolean data type?

2003-07-13 Thread Phil Bitis
You can use BIT or BOOL, but these are currently just synonyms for TINYINT(1). Still your best bet though. The manual says under new features planned for 5.1: Optimise BIT type to take 1 bit (now BIT takes 1 char) - Original Message - From: Dan Anderson [EMAIL PROTECTED] To: [EMAIL

Re: does mySQL support a boolean data type?

2003-07-13 Thread Phil Bitis
int(1) takes up 4 bytes worth of space, and just displays 1 character. BIT or TINYINT(1) take up 1 byte. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, July 13, 2003 6:05 PM Subject: Re: does mySQL support a boolean data type? why don't you use int(1)

Re: does mySQL support a boolean data type?

2003-07-13 Thread nospam
ehm, why do i say INT(1) then, and not just INT? but one could also take a 1 char type and perform some AND and OR on that one by hand. it's not really fast but it's possible right now. and it should be possible to convert the table later (for version 5.1 maybe) and with a little abstraction in

Re: does mySQL support a boolean data type?

2003-07-13 Thread Phil Bitis
Presumably if you don't specify a display size it defaults to the maximum. I'm just quoting from the manual, have a look at 6.2 Column Types - Original Message - From: [EMAIL PROTECTED] To: Phil Bitis [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, July 13, 2003 7:40 PM Subject: Re:

Re: does mySQL support a boolean data type?

2003-07-13 Thread Jim McAtee
If storage space is really a big motivator, you can roll your own by using something like unsigned integers, each of which will accomodate 32 bit fields. Then use bitmasks to read/write the values. Probably makes writing WHERE clauses a bit tedious, and doing joins on the bit fields may not be

Re: Storage efficiency of VARCHARs

2003-07-13 Thread Dan Nelson
In the last episode (Jul 13), Dan Anderson said: I am curious about the internal representation of VARCHARS. I cannot find any documentation on it in the mySQL manual. Will a VARCHAR(10) take up less space then a VARCHAR(80), even though they are variable? It's documented at least twice in

Adding FK via Alter Table not working

2003-07-13 Thread David Corsaut
trying to add a FK to an existing table, to see table structures, alter table syntax and error refer to http://sourcepost.sytes.net/sourceview.aspx?source_id=6332 = David L. Corsaut [EMAIL PROTECTED] mobile: 206.790.0969 __ Do you Yahoo!? SBC Yahoo! DSL - Now

Re: mysql.sock

2003-07-13 Thread Aftab Jahan Subedar
Probably it did not start at all. check if it started. ps -ax|grep mysql John Nichel wrote: Oliver Etzel - GoodnGo.COM (R) wrote: Hello all, after Installing mysql I started the mysql daemon.. The I tried to log in to my mysql database and got the message could not find mysql.sock in

Re: Adding FK via Alter Table not working

2003-07-13 Thread Heikki Tuuri
David, - Original Message - From: David Corsaut [EMAIL PROTECTED] Newsgroups: mailing.database.mysql Sent: Sunday, July 13, 2003 11:07 PM Subject: Adding FK via Alter Table not working trying to add a FK to an existing table, to see table structures, alter table syntax and error

Re: InnoDB Performance issues

2003-07-13 Thread Heikki Tuuri
Nicholas, - Original Message - From: Nicholas Elliott [EMAIL PROTECTED] Newsgroups: mailing.database.mysql Sent: Friday, July 11, 2003 6:04 PM Subject: InnoDB Performance issues --=_NextPart_000_003B_01C3479C.77A1AB60 Content-Type: text/plain; charset=iso-8859-1

Re: innodb file won't shrink

2003-07-13 Thread Heikki Tuuri
Steve, - Original Message - From: Steve [EMAIL PROTECTED] Newsgroups: mailing.database.mysql Sent: Thursday, July 10, 2003 11:24 PM Subject: Re: innodb file won't shrink I found the following thread:

Re: MySql Rollback in PHP within a website

2003-07-13 Thread Heikki Tuuri
Bruce, - Original Message - From: bruce [EMAIL PROTECTED] Newsgroups: mailing.database.mysql Sent: Sunday, July 13, 2003 11:32 PM Subject: MySql Rollback in PHP within a website Hey... I have a question. I need to be able to try to perform a database update, but if it doesn't

Re: InnoDb and fragmentation

2003-07-13 Thread Heikki Tuuri
Sorry, - Original Message - From: Heikki Tuuri [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, July 08, 2003 12:39 AM Subject: Re: InnoDb and fragmentation Mike, ... So how do I defrag the InnoDb file space so I can get it back up to speed? The simplest method is ALTER

MySql Rollback in PHP within a website

2003-07-13 Thread bruce
Hey... I have a question. I need to be able to try to perform a database update, but if it doesn't succeed, I need to be able to rollback the changes, and to inform the user that the changes didn't succeed. I've looked at the MySql site, and can see somewhat how the Commit/RollBack functions

Re: Stopping MySQL taking down a server?

2003-07-13 Thread Andreas D. Landmark
On Saturday 12 July 2003 22:22, Dan Nelson wrote: In the last episode (Jul 12), Tim Fountain said: This may be a silly question but what can be done to stop load-intensive MySQL processes taking down a server? Things like adding fulltext indexes to very large tables, or selects on very

Re: does mySQL support a boolean data type?

2003-07-13 Thread Andreas D. Landmark
On Sunday 13 July 2003 19:16, Sagi Bashari wrote: Use unsigned tinyint(1) with 1 and 0 as values. On 13/07/2003 19:41, Dan Anderson wrote: I ran a search through the mySQL manual and google and could not find a satisfactory answer. Does mySQL support the declaration of a boolean data type?

Ver 5

2003-07-13 Thread Andy Hartman
After I downloaded the Ver 5 Dev tree how do I get it active. I tried the Windows stuff on the Mysql site with no luck. I run WIndows/ME and have Ver3.23 running. When I try to use the instructions for Compile it fails looking for .c pgms

Re: Request modelling

2003-07-13 Thread Becoming Digital
Actually, Live and Learn is correct. Life and Learn makes no sense. Edward Dudlik Becoming Digital www.becomingdigital.com Did I help you? Want to show your thanks? www.amazon.com/o/registry/EGDXEBBWTYUU - Original Message - From: Nils Valentin [EMAIL PROTECTED] To: Bruce Feist

RE: Recomended RAM for production server. 3Gb overboard?

2003-07-13 Thread Ow Mun Heng
Hi, This is OFF-TOPIC but can you tell me how I can 'dedicate' a chunk of memory to MySQL Query Caching? I have 512MB but as listed below, a lot of those are being used as 'cached and Inact_dirty' Whatever is Inact_dirty anyway? MemTotal: 513988 kB MemFree:166468 kB

query help!!!

2003-07-13 Thread bruce
Hi... I have a questiona problem actually!!! I'm trying to figure out how to determine the descendents of a given child would be. The table defs are...: CREATE TABLE ItemTbl ( id int(5) NOT NULL auto_increment, itemnamevarchar(25) NOT NULL default '',

Re: query help!!!

2003-07-13 Thread Phil Bitis
Hiya. I take it you mean ancestors rather than descendants. For finding descendants I've been using tables like this: ID ParentIDLineage 1000/100 101100/100/101 102100/100/102 103101/100/101/103 104103

Re: Adding FK via Alter Table not working

2003-07-13 Thread Ryan Henderson
Firstly you need to index home_location_id in the customer table, then it should work. On 14/7/03 4:06 AM, David Corsaut [EMAIL PROTECTED] wrote: trying to add a FK to an existing table, to see table structures, alter table syntax and error refer to

test error

2003-07-13 Thread Jamie Krasnoo
Hey all, I was trying to compile, test and install MySQL-4.0.13. Compile went well and it was configured with --with--innodb --enable-assembler --prefix=/usr and nothing else. However when I make test it goes through to create, passes that then stops for 30 seconds and give the error that the

Re: Request modelling

2003-07-13 Thread Nils Valentin
Hi Edward; Thanks fot the reply. I have a double error then ;-) First mistaken whats actually correct and then even trying to fix it ;-) Never mind. Best regards Nils Valentin Tokyo/Japan 2003 7 14 10:10Becoming Digital : Actually, Live and Learn is correct. Life and Learn makes no sense.