In a groovy application the query contains just a letter in the select.
Example: SELECT a FROM Employee a WHERE a.emplID =123456
My question is that the same as: SELECT * FROM Employee WHERE emplId=123456
If not what is the above query doing?
CodePudding user response:
a
in this case is an alias to the Employee
table.
An alias is declared in the FROM
statement, then referenced in the SELECT
statement.
SELECT a
FROM Employee a
This is basically the same as:
SELECT *
FROM Employee
If you want to reference specific columns when using an alias, it would be done like this:
SELECT a.ID, a.Name, a.Salary
FROM Employee a
Hope this helps
CodePudding user response:
In your example a represents the Employee data, and is the same as saying Employee.*. So, yes it's the same as selecting all the data being returned by that query.