Re: Newbie Question

2005-11-14 Thread Scott Noyes
I would just like to ask a somewhat not so intelligent question. What is the downside of indexing almost all of the fields in a table? Is it advisable? Indexes have to be built They also consume disk space, so if you're tight on hard drives, they might put you over the top. -- Scott

Re: Multiple MySQL services running on the same machine

2005-11-09 Thread Scott Noyes
procedures and triggers, and 5.0.15-max so I can play with even more new features (like the Federated engine). I ought to have 4.0 on here too, since that's what our production environment uses. -- Scott Noyes [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql

Re: MySQL insert performance

2005-11-09 Thread Scott Noyes
How long should it take to insert approx 30,000 rows into MySQL. Depends on the data and field structure. Do you have lots of indexes on the table? It takes me about 30 mins. There are some tips at http://dev.mysql.com/doc/refman/4.1/en/insert-speed.html -- Scott Noyes [EMAIL PROTECTED

Re: Delete all but the newest 100 records?

2005-11-08 Thread Scott Noyes
BY `timestamp` DESC LIMIT 100; DELETE FROM `table` WHERE `timestamp` @theDeadline; It might not be quite perfect if certain critical records have the same timestamp, but it will work in most cases. -- Scott Noyes [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http

Re: How to find missing rows from subset of table using Left Join?

2005-11-08 Thread Scott Noyes
select * from table1 t1 left join table2 t2 on t1.date1=t2.date2 where t2.date2 is null where t2.name='Smith' Maybe this? select * from table1 t1 left join table2 t2 on t1.date1 = t2.date2 AND t2.name = 'Smith' WHERE t2.date2 is null; -- Scott Noyes [EMAIL PROTECTED] -- MySQL General Mailing

Re: Can't reference column aliases

2005-11-07 Thread Scott Noyes
Why isn't there a way to reference column aliases in the columns list or where clause? http://dev.mysql.com/doc/refman/5.0/en/problems-with-alias.html That's why. -- Scott Noyes [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe

Re: MySQL 5.0 certification

2005-10-10 Thread Scott Noyes
Has anyone been involved with the 5.0 certification program. I've read that the new MySQL 5 certificates will be available about 2 or 3 months after MySQL 5 becomes a Production Release. http://db4free.blogspot.com/2005/10/mysql-5-certifications.html -- Scott Noyes [EMAIL PROTECTED] -- MySQL

Re: Global Replace

2005-09-30 Thread Scott Noyes
appropriate. -- Scott Noyes [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: how do I select among 2 columns ?

2005-09-14 Thread Scott Noyes
I have a table like this : name, email_1, email_2 and I want to display in a web page name, email_1 if it exists, or email_2 if email_1 do NOT exist. SELECT name, IF(email_1 IS NOT NULL AND email_1 != '', email_1, email_2) AS email FROM theTable; -- MySQL General Mailing List For list

Re: Dump/restore - lost data!

2005-09-08 Thread Scott Noyes
We did a mysqldump to produce a transport file from version 3 of mysql to insert the data into version 4 of mysql. The encoded numbers were munged, presumably because they were binary data in the dump. Isn't this what the --hex-blob option to mysqldump is for? -- MySQL General Mailing List

Re: Re: Dump/restore - lost data!

2005-09-08 Thread Scott Noyes
Isn't this what the --hex-blob option to mysqldump is for? There is no such option to mysqldump in version 4.1.11. From the manual: --hex-blob Dump binary string columns using hexadecimal notation (for example, 'abc' becomes 0x616263). The affected columns are BINARY, VARBINARY, and BLOB

Re: Delayed UPDATE execution?

2005-09-08 Thread Scott Noyes
So now my question... is it possible that MySQL didn't execute that first UPDATE query on that first page until after the rest of the process completed? - The customer page is a basic form that posts the information to itself with a simple UPDATE command and then goes to the next page.

Re: timestamp and php

2005-08-30 Thread Scott Noyes
2005-08-30 13:50.05 this is the text content (i) sort the returned rows in order (latest first) http://dev.mysql.com/doc/mysql/en/sorting-rows.html (ii) be able to extract the individual parts of the date and display them in UK format (ddmm)

Re: Incorrect column name

2005-08-29 Thread Scott Noyes
mysql create table prova (`Termination ` int); ERROR 1166: Incorrect column name 'Termination ' The manual says: Database, table, and column names should not end with space characters. http://dev.mysql.com/doc/mysql/en/legal-names.html -- MySQL General Mailing List For list archives:

Re: fehler

2005-08-18 Thread Scott Noyes
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /srv/www/htdocs/web1/html/inc/class/sql.php on line 88 I would guess that there is some problem with the syntax of your SQL. If you make it a habit to do queries like this: $sql = SELECT * FROM table; $result =

Re: Why does this fail

2005-08-16 Thread Scott Noyes
Can anyone explain why this SQL statement would fail? A friend was asked it in a pre-interview assessment and it threw him a bit. SELECT T1.BldgName T1.StreetName, T1.Locality, T1.PostTown from PstlAddr T1 Where T1.City='London' AND NOT EXISTS (SELECT T2.Pstl_Address_PK from PrsnAddress T2)

Re: cast and numeric conversion

2005-08-16 Thread Scott Noyes
I've got two columns, one is 'integer' (and store negative value), the other one 'tinyint unsigned' (only 1 stored in it), when I multiply these columns, quantity with negative value does not show up. (I expect -50*10 to give : -500, but the field stay blank.) I've look a bit at the

Re: Query Help

2005-08-12 Thread Scott Noyes
Select s.StudentID, s.StudentName from Student s, SubjectGrade sg where s.StudentID = sg.StudentID and sg.Subject = 'Maths' and sg.Subject = 'Chem' and sg.Grade = 'A' Take a close look at the WHERE clause: sg.Subject = 'Maths' and sg.Subject = 'Chem' will never return a result - how could the

Re: Query Help

2005-08-12 Thread Scott Noyes
SELECT s.StudentID, StudentName FROM Student s JOIN StudentGrade sg1 USING (StudentID) JOIN StudentGrade sg2 USING (StudentID) WHERE sg1.Subject = 'Maths' AND sg1.Grade = 'A' AND sg2.Subject = 'Chem' AND sg2.Grade = 'A' So i have to write 3 join if I have 3 conditions and so on,

Re: Complex query. (It's killing me)

2005-08-12 Thread Scott Noyes
Shipped Undelivered Returned Open 12/8/2005 143 3 3 Does this mean of the 14 shipped on 12/8/2005, 3 were returned at some later date, or does it mean that you shipped 14 on 12/8/2005, and on that same day 3 unrelated shipments came back, each of which

Re: Complex query. (It's killing me)

2005-08-12 Thread Scott Noyes
mysql Ver 12.22 Distrib 4.0.20, for mandrake-linux-gnu (i586) With 4.1, it might have been a little easier using some subqueries. But with 4.0, I don't think we can get the results you're looking for in a single query, without some really nasty setup. Part of the issue is that we need to join

Re: HELP! sql command question for mysql

2005-08-11 Thread Scott Noyes
It appears that you don't need to specify in the Group By clause all the columns that are referenced without an aggregate function True. For example this query would be invalid in MSSQL but valid in MySQL: select id, vendor, sum(price) from p group by id In this case, `vendor` would

Re: MYSQLDUMP and Triggers, Functions and SP

2005-08-10 Thread Scott Noyes
mysqldump bundled with 5.0.10 does not seem to support the above features. http://dev.mysql.com/doc/mysql/en/mysqldump.html lists triggers in 5.0.11. I see no mention there of functions or stored procedures. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To

Re: create database outside /mysql/data/

2005-08-08 Thread Scott Noyes
Yes, using symbolic links. http://dev.mysql.com/doc/mysql/en/windows-symbolic-links.html On 8/8/05, l'[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I installed Mysql on windows and found out that the documentation does not talk about installing the database in another directory or partition of the

Re: Query Combining tables

2005-08-05 Thread Scott Noyes
Is this what you're after? SELECT COUNT(*) AS members, SUM(IF(payment_type = 'creditcard', 1, 0)) AS pay_by_card FROM members JOIN payments USING (memno) GROUP BY group; On 8/5/05, Russell Horn [EMAIL PROTECTED] wrote: I'm having difficulty writing a query as follows. I'm unsure

Re: top one row

2005-08-05 Thread Scott Noyes
You're looking for the rows containing the group-wise maximum. There's an explanation in the manual, section 3.6.4, http://dev.mysql.com/doc/mysql/en/example-maximum-column-group-row.html On 8/5/05, Kemin Zhou [EMAIL PROTECTED] wrote: I have a simple table col1 col2col3 A 2

Re: top one row

2005-08-05 Thread Scott Noyes
SELECT col1, MAX(col2), col3 FROM table GROUP BY col1; Because col3 is not part of the GROUP BY clause, this query will not guarantee that the col3 returned is associated with the col2 returned. In other words, running this query on the table containing col1 / col2 / col3 1 11 1

Re: top one row

2005-08-05 Thread Scott Noyes
mysql SELECT VERSION(); +---+ | VERSION() | +---+ | 4.1.7-nt | +---+ 1 row in set (0.00 sec) mysql CREATE TABLE test (col1 INT, col2 INT, col3 INT); Query OK, 0 rows affected (0.08 sec) mysql INSERT INTO test VALUES (1, 1, 1), (1, 2, 3); Query OK, 2 rows affected (0.02

Re: SELECT DISTINCT

2005-08-05 Thread Scott Noyes
Here's one (not very clean, but it works) way to do it: SELECT id, params FROM table GROUP BY params; The trouble is, how do you know which id should come with it? If you table is id param 1 1 2 1 should the query return 1, 1 or 2, 1 ? -- MySQL General Mailing List For list archives:

Re: UNION - different result when statements interchanged

2005-08-05 Thread Scott Noyes
From http://dev.mysql.com/doc/mysql/en/union.html : Before MySQL 4.1.1, a limitation of UNION is that only the values from the first SELECT are used to determine result column types and lengths. This could result in value truncation if, for example, the first SELECT retrieves shorter values than

Re: 2 questions on Auto Increment fields

2005-08-05 Thread Scott Noyes
1) For what I see on the MySQL manual you can have an Auto Increment not null Field as the primary key. Say that you have a table with only two columns the first being an Auto_Increment. How do I write an INSERT or REPLACE SQL statement to insert data on this table? Can I write it so that it

Re: How to find Balance?

2005-08-04 Thread Scott Noyes
Is this what you had in mind? It assumes MySQL version 4.1 or later: SELECT id, price - (SELECT SUM(IF(type = 'PAID', amount, 0 - amount)) FROM payment py WHERE py.id http://py.id = pr.id http://pr.id) AS balance FROM price pr; On 8/4/05, Yesmin Patwary [EMAIL PROTECTED] wrote:

Re: 4.1 and unions

2005-08-04 Thread Scott Noyes
UNION is not broken; the syntax in the given comment is incorrect. You can do SELECT * FROM table UNION SELECT * FROM table or (SELECT * FROM table) UNION (SELECT * FROM table) but not SELECT * FROM table UNION (SELECT * FROM table) On 8/4/05, Mike Johnson [EMAIL PROTECTED] wrote: Hi all,

Re: indexes

2005-08-04 Thread Scott Noyes
Some sections of the manual seem to indicate that it's better to create indexes after data population, rather than before. See section 7.2.14, Speed of INSERT Statements. The general procedure there is to load the data using LOAD DATA INFILE, and then use myisamchk. This creates the index tree