Re: [PHP] Re: A MySQL Question

2008-12-07 Thread Chris

Nathan Rixham wrote:

tedd wrote:

At 3:24 PM + 12/7/08, Nathan Rixham wrote:
On the same not does anybody else frequently use (or even know about) 
the awesome spatial extension for mysql? or use the 
information_schema tables?



I've certainly never used them, but I can imagine information_schema 
tables that are similar to DOCTYPE as found in xml for defining fields 
-- is that it?


Cheers,

tedd


not many have :p but there's so much more power and speed can be opened 
up by using them.. to get you started ( I highly recommend this )


try:
SELECT * FROM `information_schema`.`TABLES`;

then:
SELECT * FROM `information_schema`.`COLUMNS`


The idea behind information_schema is it should be reasonably portable 
and should work on most types of db's.


--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: A MySQL Question

2008-12-07 Thread Nathan Rixham

tedd wrote:

At 3:24 PM + 12/7/08, Nathan Rixham wrote:
On the same not does anybody else frequently use (or even know about) 
the awesome spatial extension for mysql? or use the information_schema 
tables?



I've certainly never used them, but I can imagine information_schema 
tables that are similar to DOCTYPE as found in xml for defining fields 
-- is that it?


Cheers,

tedd


not many have :p but there's so much more power and speed can be opened 
up by using them.. to get you started ( I highly recommend this )


try:
SELECT * FROM `information_schema`.`TABLES`;

then:
SELECT * FROM `information_schema`.`COLUMNS`

then cunning way's to combine the two.. for instance you could query 
these two tables to return back a list of all columns in database X 
which are of type text and use them to search you're entire database in 
one go like:


select table_name, column_name from information_schema.columns WHERE 
table_schema='DB_NAME' AND data_type IN ('char','varchar','text') AND 
CHARACTER_MAXIMUM_LENGTH >3;select table_name, column_name from 
information_schema.columns WHERE table_schema='DB_NAME' AND data_type IN 
('char','varchar','text') AND CHARACTER_MAXIMUM_LENGTH >3;


replace DB_NAME for the database you want to search, you may want to 
include type's like mediumtext etc..


point is, the information_schema tables reside in memory so are ultra 
quick to query; and they are always up to date; and they give you far 
more information than normally available.


so many options.. rows in a database (not table)
SELECT SUM(TABLE_ROWS) FROM `information_schema`.`TABLES` WHERE 
TABLE_SCHEMA='DB_NAME';


etc etc..

regards!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: A MySQL Question

2008-12-07 Thread tedd

At 3:24 PM + 12/7/08, Nathan Rixham wrote:
On the same not does anybody else frequently use (or even know 
about) the awesome spatial extension for mysql? or use the 
information_schema tables?



I've certainly never used them, but I can imagine information_schema 
tables that are similar to DOCTYPE as found in xml for defining 
fields -- is that it?


Cheers,

tedd
--
---
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: A MySQL Question

2008-12-07 Thread Nathan Rixham

tedd wrote:

Hi gang:

I just interviewed for a job teaching at the local college (imagine me 
taking minds of mush and molding them to the world according to tedd -- 
frightening huh?)


In any event, the interviewer asked me how long I've been using MySQL 
and I replied several years. After which she asked a single question, 
which was "What does EXIST mean?"


Now without running to the manuals, please be honest and tell me how 
many of you know off the top of your head what EXIST means? I would be 
curious to know.


I answered the question correctly, (I'm one of those weird types who 
read manuals for fun) but I have never used EXIST in a query. Have any 
of you?


I knew it "exist"ed but have never felt the need to use it; and upon 
refreshing my knowledge from the manual can safely say I'll continue not 
to use it.


On the same not does anybody else frequently use (or even know about) 
the awesome spatial extension for mysql? or use the information_schema 
tables?




And while we're on the subject of MySQL -- while we all know how to 
write it, how do you say it?


I've read that the common way is to say "My Squell", or something like 
that. But I always sounded out each letter, such as "My S-Q-L". The 
interviewer pronounced it the same as I, but I have heard others say it 
differently.


What say you?


I'm in the My-S-Q-L boat as well; also "Post-gres" and "S-Q-L Server" 
for ms.. none of this sequele malarky




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: A MySQL question

2003-07-14 Thread Kevin Stone

"Zavaboy" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Ok, I want to delete only 1 row off of a database table...
> Example:
> I have a table with columns "user" and "item"...
> Lets say the table contains the following rows (user | item):
> 582-668243 | Toothbrush
> 582-668243 | Toothbrush
> 582-668243 | Toothbrush
> 582-668243 | Trash can
> 582-668243 | Trash can
> 582-668243 | Something else
> 582-668243 | Something else
> 582-668243 | Something else
> 582-668243 | Something else
> 720-387690 | Dog treats
> 720-387690 | Car
> 720-387690 | Car
> 720-387690 | Toothbrush
> 720-387690 | Toothbrush
>
> Ok, user 582-668243 is buying a lot, eh? LoL
> Anyway, how can I remove only 1 Toothbrush from user 582-668243?
> I just want the query... I've been trying to find it out for a few hours
> now...
>
> Thanks in advance!
>
> --
>
> - Zavaboy
> [EMAIL PROTECTED]
> www.zavaboy.com


You can try putting "LIMIT 1" on the end of your query but to be honest I
don't know if  LIMIT works with the DELETE command.  Worth a try.  Ideally
you should have an additional column with an autoincrementing value to act
as your primary key and you delete on that key.

- Kevin



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php