RE: Hmm looks like this query works
Ah - I missed the weighting requirement - forget my last post then... You could try increasing the "0.1" weighting factor until it gave you the required result instead.. Cheers, Andrew -Original Message- From: Eric Wagner [mailto:[EMAIL PROTECTED] Sent: Tuesday 10 June 2003 21:36 To: Dathan Vance Pattishall; [EMAIL PROTECTED] Subject: RE: Hmm looks like this query works I think your query will just return the first 10 values in the table sorted in random order due to how MySQL handles queries that use ORDER BY and LIMIT: [from mysql documentation] If you use LIMIT # with ORDER BY, MySQL will end the sorting as soon as it has found the first # lines instead of sorting the whole table http://www.mysql.com/doc/en/LIMIT_optimisation.html > -Original Message- > From: Dathan Vance Pattishall [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 10, 2003 11:19 AM > To: [EMAIL PROTECTED] > Subject: Hmm looks like this query works > > > I have a question. If I wanted to sort randomly on a column weighted > by the value of the column will does this query work > > SELECT val_column, val_column*0.1+RAND() as rand_col from TABLE ORDER > BY rand_col limit 10; > > This should five me a random row weighted by the value of the column > is this correct? Seems to be but I might be wrong. > > Thanks for any tips > > -- > Dathan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Hmm looks like this query works
Try this instead... SELECT val_column, 0.1+RAND() as rand_col from TABLE ORDER BY rand_col limit 10; Cheers, A -Original Message- From: Eric Wagner [mailto:[EMAIL PROTECTED] Sent: Tuesday 10 June 2003 21:36 To: Dathan Vance Pattishall; [EMAIL PROTECTED] Subject: RE: Hmm looks like this query works I think your query will just return the first 10 values in the table sorted in random order due to how MySQL handles queries that use ORDER BY and LIMIT: [from mysql documentation] If you use LIMIT # with ORDER BY, MySQL will end the sorting as soon as it has found the first # lines instead of sorting the whole table http://www.mysql.com/doc/en/LIMIT_optimisation.html > -Original Message- > From: Dathan Vance Pattishall [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 10, 2003 11:19 AM > To: [EMAIL PROTECTED] > Subject: Hmm looks like this query works > > > I have a question. If I wanted to sort randomly on a column weighted > by the value of the column will does this query work > > SELECT val_column, val_column*0.1+RAND() as rand_col from TABLE ORDER > BY rand_col limit 10; > > This should five me a random row weighted by the value of the column > is this correct? Seems to be but I might be wrong. > > Thanks for any tips > > -- > Dathan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Hmm looks like this query works
I think your query will just return the first 10 values in the table sorted in random order due to how MySQL handles queries that use ORDER BY and LIMIT: [from mysql documentation] If you use LIMIT # with ORDER BY, MySQL will end the sorting as soon as it has found the first # lines instead of sorting the whole table http://www.mysql.com/doc/en/LIMIT_optimisation.html > -Original Message- > From: Dathan Vance Pattishall [mailto:[EMAIL PROTECTED] > Sent: Tuesday, June 10, 2003 11:19 AM > To: [EMAIL PROTECTED] > Subject: Hmm looks like this query works > > > I have a question. If I wanted to sort randomly on a column weighted by > the value of the column will does this query work > > SELECT val_column, val_column*0.1+RAND() as rand_col from TABLE ORDER BY > rand_col limit 10; > > This should five me a random row weighted by the value of the column is > this correct? Seems to be but I might be wrong. > > Thanks for any tips > > -- > Dathan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: Hmm looks like this query works
I want rows with a higher value to show up more often then rows with a lower value in a column. The constraint is I do not want to have multiple rows representing the same record. It's easy to solve with say 100 rows verses 30 rows using just RAND: but doing it the way I have below might achieve the same result with 1 row. -->-Original Message- -->From: Becoming Digital [mailto:[EMAIL PROTECTED] -->Sent: Tuesday, June 10, 2003 11:33 AM -->To: [EMAIL PROTECTED] -->Subject: Re: Hmm looks like this query works --> -->What's your end goal, and for what do you need/desire a "weighted -->random?" Your -->objective will determine if this is actually of use or if it simply -->appears to -->be. --> -->Edward Dudlik -->Becoming Digital -->www.becomingdigital.com --> --> -->- Original Message - -->From: "Dathan Vance Pattishall" <[EMAIL PROTECTED]> -->To: <[EMAIL PROTECTED]> -->Sent: Tuesday, 10 June, 2003 14:19 -->Subject: Hmm looks like this query works --> --> -->I have a question. If I wanted to sort randomly on a column weighted by -->the value of the column will does this query work --> -->SELECT val_column, val_column*0.1+RAND() as rand_col from TABLE ORDER BY -->rand_col limit 10; --> -->This should five me a random row weighted by the value of the column is -->this correct? Seems to be but I might be wrong. --> -->Thanks for any tips --> -->-- -->Dathan --> --> --> -->-- -->MySQL General Mailing List -->For list archives: http://lists.mysql.com/mysql -->To unsubscribe: -->http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Hmm looks like this query works
What's your end goal, and for what do you need/desire a "weighted random?" Your objective will determine if this is actually of use or if it simply appears to be. Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: "Dathan Vance Pattishall" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, 10 June, 2003 14:19 Subject: Hmm looks like this query works I have a question. If I wanted to sort randomly on a column weighted by the value of the column will does this query work SELECT val_column, val_column*0.1+RAND() as rand_col from TABLE ORDER BY rand_col limit 10; This should five me a random row weighted by the value of the column is this correct? Seems to be but I might be wrong. Thanks for any tips -- Dathan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
RE: hmm
I missed the original question but here is my two cents. The solution has to do with how you define "... used as a online database". Steve Rapaport is correct if you want to create a database accessable via a browser, but if you just want a database available on the net all you need (on the server side at least) is a mysql database on an internet connected server with mysql configured to allow connections from outside. The default mysql configuration only allows connections from clients on the same computer (localhost) however you can allow connections from selected IP addresses or any outside address. See the manual about the "GRANT" command. Then, after installing the MYODBC ODBC driver on your local computer you can use ODBC aware clients (i.e. ACCESS) to connect to your database via the internet. You must use either an ODBC compliant client program (such as Microsoft ACCESS) or a client program written with native MYSQL support. I have only done this with my own client ODBC aware apps written in Delphi. I am not recommending ACCESS (I hate it) but just mention it as a commonly available ODBC client that could be used to validate the concept (as I did). --Richard > > By the way you're using the terms, I would guess you're hoping > to make a new database, and place it "on the web". > > In that case, Mysql is probably at too low a level of > detail for your needs. To solve your problem you > would need to learn: > > HTML > CGI > middleware (ASP, PHP, etc) > MySQL > SQL > database design > > My guess is you are new to most or all of these. In this case > you would do better with one of these two prepackaged database products: > > 1. Filemaker Pro http://www.filemaker.com/ > 2. Microsoft Access 2000 (you know where) > > Both give you, to some extent, the ability to construct a > database, configure the interface, and put it on the web, > without knowing much SQL, middleware, etc. In the case of > Filemaker, you don't even need to know HTML or be artistic. > > Perhaps this helps. > > Steve Rapaport > > > > ] > ] I thought Mysql was a server that could be used as a online database? > ] If it is, is there some material I have not read that tells me how to do > ] this? > ] I understood most of the information I read about Mysql. I was under the > ] understanding sql is the way to make a online database > ] > ] Harry > ] > ] > ] - > ] Before posting, please check: > ]http://www.mysql.com/manual.php (the manual) > ]http://lists.mysql.com/ (the list archive) > ] > ] To request this thread, e-mail <[EMAIL PROTECTED]> > ] To unsubscribe, e-mail > ] <[EMAIL PROTECTED]> > ] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > ] > - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: hmm
By the way you're using the terms, I would guess you're hoping to make a new database, and place it "on the web". In that case, Mysql is probably at too low a level of detail for your needs. To solve your problem you would need to learn: HTML CGI middleware (ASP, PHP, etc) MySQL SQL database design My guess is you are new to most or all of these. In this case you would do better with one of these two prepackaged database products: 1. Filemaker Pro http://www.filemaker.com/ 2. Microsoft Access 2000 (you know where) Both give you, to some extent, the ability to construct a database, configure the interface, and put it on the web, without knowing much SQL, middleware, etc. In the case of Filemaker, you don't even need to know HTML or be artistic. Perhaps this helps. Steve Rapaport ] ] I thought Mysql was a server that could be used as a online database? ] If it is, is there some material I have not read that tells me how to do ] this? ] I understood most of the information I read about Mysql. I was under the ] understanding sql is the way to make a online database ] ] Harry ] ] ] - ] Before posting, please check: ]http://www.mysql.com/manual.php (the manual) ]http://lists.mysql.com/ (the list archive) ] ] To request this thread, e-mail <[EMAIL PROTECTED]> ] To unsubscribe, e-mail ] <[EMAIL PROTECTED]> ] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php ] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: hmm
* Harry Rorarius > I thought Mysql was a server that could be used as a online database? Yes, it is... > If it is, is there some material I have not read that tells me how to do > this? Probably :o) > I understood most of the information I read about Mysql. I was under the > understanding sql is the way to make a online database When you say 'online database' I assume you mean a database accessed through the www, the http protocol part of internet...? There is no http or www functionality in mysql. You must use a programming language or some other tool to link the database with the browser, using the mysql API and usually some CGI library. There are a number of languages to choose between: c, c++, perl, php, python, java, tcl, eiffel, and any language with ODBC support: http://www.mysql.com/doc/C/l/Clients.html > There are some examples here, using perl: http://www.mysql.com/doc/P/e/Perl_DBI_Class.html > Note that these examples does not show how you make CGI applications, that is a different question. A CGI application is a program running on the web server, using http and a web browser for user interaction. The application can be an 'online database'. The output of the program is usually html (could be xml), the program code is mainly different variations over the sequence: 1) getting the input parameters, 2) prepare some sql statements, 3) execute the statements, 4) collecting the result, and 5) create the final html and present it to the user. Normally you use a CGI library to maintain the http protocol handling, but for output all you really need is to output "Content-type: text/html" and a blank line before the html. -- Roger - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: hmm
Harry, It is you need to make a WEB front end to access it -Original Message- From: Harry Rorarius [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 28, 2002 10:49 AM To: Mysql list Subject: hmm ok I thought Mysql was a server that could be used as a online database? If it is, is there some material I have not read that tells me how to do this? I understood most of the information I read about Mysql. I was under the understanding sql is the way to make a online database Harry - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: hmm
On Thursday 28 March 2002 9:48 am, Harry Rorarius wrote: > I thought Mysql was a server that could be used as a online database? Yes > If it is, is there some material I have not read that tells me how to do > this? What are you trying to do? You have not been at all clear in your requirements. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php