Re: [PHP-DB] WHERE clause
MySQL is very well documented as well. www.mysql.com, click on documentation. "Dl Neil" <[EMAIL PROTECTED]> wrote in message 160001c1c356$2f629c40$c200a8c0@jrbrown...">news:160001c1c356$2f629c40$c200a8c0@jrbrown...; > Jennifer, > > > Wondering do I have to have the WHERE clause in a select query? > > $b=mysql_query( SELECT * FROM my_table) <-can I use something like > this > > or do I have to put WHERE in the statement? > > > Hate to answer a question with a question, but what happened when you > tried typing this query into the MySQL client? (a far faster solution > than waiting for someone on the list to get back to you!) > > RTFM: 6.4.1 SELECT Syntax > > SELECT [STRAIGHT_JOIN] >[SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] >[SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] [HIGH_PRIORITY] >[DISTINCT | DISTINCTROW | ALL] > select_expression,... > [INTO {OUTFILE | DUMPFILE} 'file_name' export_options] > [FROM table_references > [WHERE where_definition] > [GROUP BY {unsigned_integer | col_name | formula} [ASC | DESC], > ...] > [HAVING where_definition] > [ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] > ,...] > [LIMIT [offset,] rows] > [PROCEDURE procedure_name] > [FOR UPDATE | LOCK IN SHARE MODE]] > > When you read these 'template' commands in the manual, if the > word/clause/construct is enclosed in square brackets, eg > > [WHERE where_definition] > > then it is optional. Thus the minimalist SELECT statement looks like: > > SELECT select_expression,... > > which will only work with some scalar expression, eg SELECT 2+2; or > SELECT month( '2002-03-04' ); so the minimum to work with a table is: > > SELECT select_expression,... FROM table_references > > and you're bang on the money! > > Regards, > =dn > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] WHERE clause
Jennifer, > Wondering do I have to have the WHERE clause in a select query? > $b=mysql_query( SELECT * FROM my_table) <-can I use something like this > or do I have to put WHERE in the statement? Hate to answer a question with a question, but what happened when you tried typing this query into the MySQL client? (a far faster solution than waiting for someone on the list to get back to you!) RTFM: 6.4.1 SELECT Syntax SELECT [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT] [SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS] [HIGH_PRIORITY] [DISTINCT | DISTINCTROW | ALL] select_expression,... [INTO {OUTFILE | DUMPFILE} 'file_name' export_options] [FROM table_references [WHERE where_definition] [GROUP BY {unsigned_integer | col_name | formula} [ASC | DESC], ...] [HAVING where_definition] [ORDER BY {unsigned_integer | col_name | formula} [ASC | DESC] ,...] [LIMIT [offset,] rows] [PROCEDURE procedure_name] [FOR UPDATE | LOCK IN SHARE MODE]] When you read these 'template' commands in the manual, if the word/clause/construct is enclosed in square brackets, eg [WHERE where_definition] then it is optional. Thus the minimalist SELECT statement looks like: SELECT select_expression,... which will only work with some scalar expression, eg SELECT 2+2; or SELECT month( '2002-03-04' ); so the minimum to work with a table is: SELECT select_expression,... FROM table_references and you're bang on the money! Regards, =dn -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] WHERE clause
On Sun, 3 Mar 2002, Jennifer Downey wrote: >Wondering do I have to have the WHERE clause in a select query? > >$b=mysql_query( SELECT * FROM my_table) <-can I use something like this >or do I have to put WHERE in the statement? The where clause is optional. -- --- Greg Donald - http://destiney.com/ http://phprated.com/ | http://phplinks.org/ | http://phptopsites.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] WHERE clause
Wondering do I have to have the WHERE clause in a select query? $b=mysql_query( SELECT * FROM my_table) <-can I use something like this or do I have to put WHERE in the statement? Thanks Jennifer -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php