How it works a mysql query with alias?

前端 未结 4 738
旧时难觅i
旧时难觅i 2021-01-28 10:17

I\'m new in this comunnity and I need to work with a query that get data from a mysql database, I have this query, but I need to add a new table and I don\'t understand why the

4条回答
  •  一向
    一向 (楼主)
    2021-01-28 10:37

    A SQL Alias is just what the name says, an alias. It's simply another name (a shorter name) for your table name.

    So in your example the table name is Inscripciones, and in this line FROM Inscripciones ins you're saying "ins" is an alias to Inscripciones. Its just a way to make the query smaller/simpler. An alias is like a nickname (i.e. an alias for Michael is "Mike")

    Aliases are normally set with "AS" like this:

    SELECT * FROM Users AS u
    

    but can be shortened like this:

    SELECT * FROM Users u
    

提交回复
热议问题