Posts

Showing posts with the label Alias

SQL Server, speaking about ALIAS ...learn the rule

Image
Hello friends! Welcome back to this short post. We will speak about Alias and only two minute to learn some important things is really a big deal ! So think big and think that Share knowledge is the only way! Alias I think that everyone know what an alias is. We can have a table and call it with another name or we can have a field of a table and call it with another another name. SELECT CODE FROM ORDTES SELECT CODE as CODICE FROM ORDTES as ORDINI  Where 'as' is optional   Using alias if your statement represents a derived table then you can refer to it through the alias: SELECT * FROM ORTDES JOIN (SELECT CODE AS CODICE FROM ORDTES) AS ORDINI ON ORDINI.CODICE = ORDTES.CODE   Tips: You can see the Alias also int the execution plan   And then.. Suppose now to play with our usual ORDTES table. Suppose again you need to write a statement to get the max number of document. Using a not efficient way (i know) we could write: SELECT id FR...