Home | Php | JavaScript | SQL | HTML | Server Admin | Tools
Simple Statements
Other sites
Image Editor
Top 10 web hosting reviews

Simple SQL statements

One of the simplest statements in SQL is retrieving all records in a table. The syntax for this is SELECT * FROM `tablename`. The asterisk is a wildcard meaning "everything". This statement will return all fields of all rows in the table. If you only want some of the fields (columns), or you want them in a certain order, you can specify them in the statement. SELECT `column_one`, `column_two` FROM `tablename`. If you want the columns in the other order, your statement would look like this: SELECT `column_two`, `column_one` FROM `tablename`. You can also limit the query so it will only return a certain number of rows, using the LIMIT command. The following statement will only return the first 3 rows found. SELECT `column_two`, `column_one` FROM `tablename` LIMIT 3

To be continued...

Link back to this page

Copy and paste this HTML code into your page to link back to this very page:

Or just link to the WebCodingTech site:

And your link will look like this:
      Inspired by stuff found at www.webcodingtech.com.


Copyright © 2005 WebCodingTech.com Our URL is: http://www.webcodingtech.com