Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2007
    Posts
    77

    Unanswered: mysterious letter?

    Hi to all,

    Has anyone noticed that when you used the MySQL Query Browser and then try to click any of the existing schemas in you database, and then double click a certain table in that chosen schem. what happens is that you are issuing a select query of all the data in that particular table right?

    Ex: I double clicked my users table, then a certain text appears at the Resultset Tab:

    SELECT * FROM tblusers t;

    Notice the letter 't' in there? I have been wondering what is the purpose or significance of that letter, every time you double click a table and when that select query text appears, a letter (any letter) appends to the select query text?

    Any ideas on what is that?
    I noticed that the appended letter is the first letter of the table that I have double clicked.

    thanks and god bless!

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by Panoy
    I noticed that the appended letter is the first letter of the table that I have double clicked.
    it is? that's cute

    what you're seeing there is called a table alias

    you are not required to use one, except if you're referencing the same table more than once in a query
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Mar 2007
    Posts
    77
    is that all? hey thanks

  4. #4
    Join Date
    Mar 2007
    Location
    636f6d7075746572
    Posts
    770
    Yes that is all, however, tell me which is easier to write?

    Code:
    SELECT t1.column1
            , t2.column2
            , t1.column3
    FROM table1 t1
    JOIN table2 t2 ON t2.id = t1.id
    WHERE t1.id IN (
      SELECT t3.id 
      FROM table3 t3
    )
    OR

    Code:
    SELECT table1.column1
            , table2.column2
            , table1.column3
    FROM table1
    JOIN table2 ON table2.id = table1.id
    WHERE table1.id IN (
      SELECT table3.id 
      FROM table3
    )
    I know which I prefer. Now just imagine if you table name is "myReallyLongTableName". How do you fancy writing that out several times (and possibly getting a spelling mistake).

Posting Permissions

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