SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard subnet_rx's Avatar
    Join Date
    Aug 2001
    Location
    Hattiesburg, MS
    Posts
    1,085
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SQL syntax questions

    I've got a book here on SQL, as well as, several PHP/MySQL books, but I'm having problems figuring out three things.

    1. What is the * for in "SELECT * FROM tbl_name"?

    2. I'm looking at the MySQL docs on DATE_FORMAT, and the only examples it gives are in the format "SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');" How can I apply this in PHP? The result of the query will be the correctly formatted date?

    3. Can functions like DATE_FORMAT only be applied after SELECT or can they be elsewhere in the statement?

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by subnet_rx
    I've got a book here on SQL, as well as, several PHP/MySQL books, but I'm having problems figuring out three things.

    1. What is the * for in "SELECT * FROM tbl_name"?
    The * is a shorthand way of selecting all columns from the table.
    Quote Originally Posted by subnet_rx
    2. I'm looking at the MySQL docs on DATE_FORMAT, and the only examples it gives are in the format "SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y');" How can I apply this in PHP? The result of the query will be the correctly formatted date?

    3. Can functions like DATE_FORMAT only be applied after SELECT or can they be elsewhere in the statement?
    Functions like date_format can appear anywhere you need them.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •