Search code examples
mysqlsql-order-by

What is the meaning of the letter 't' in mysql query


SELECT * FROM (SELECT * FROM my_table ORDER by row_id DESC LIMIT 8) t ORDER BY RAND()

I saw this in an answer, What does the 't' mean before ORDER BY?


Solution

  • Subqueries need an alias name. In this case it is t.

    With this name you can refer to the result of the subquery and its columns.