SQL aliases can be used with database tables and with database table columns, depending on task you are performing.
SQL column aliases are used to make the output of your SQL queries easy to read and more meaningful:
SELECT Employee, SUM(Hours) As SumHoursPerEmployee
FROM EmployeeHours
GROUP BY Employee
In the example above we created SQL alias SumHoursPerEmployee and the result of this SQL query will be the following:
Employee SumHoursPerEmployee
John Smith 25
Allan Babel 24
Tina Crown 27
Consider the following SQL statement, showing how to use SQL table aliases:
SELECT Emp.Employee
FROM EmployeeHours AS Emp
Here is the result of the SQL expression above:
Employee
John Smith
Allan Babel
Tina Crown
The SQL table aliases are very useful when you select data from multiple tables.
Popular Posts
-
ADO .NET Most applications need data access at one point of time making it a crucial component when working with applications. Data access i...
-
The SQL AVG aggregate function selects the average value for certain table column. Have a look at the SQL AVG syntax: SELECT AVG(Column1) FR...
-
As mentioned on the .NET Framework page, .NET Framework is designed for cross-language compatibility. Cross-language compatibility means .NE...
-
Using OleDb Provider The Objects of the OleDb provider with which we work are: The OleDbConnection Class The OleDbConnection class represent...
-
Learning about Variables Using Variables is one of the most basic and important subjects in programming, so this lesson is very important. V...
-
The page directive lets you define one or more of the following case-sensitive attributes: * import="package.class" or import=...
-
4.3 Using the FCL “Give a man a fish and you feed him for a day. Teach a man to fish and you feed him for a lifetime.” The IO strea...
-
If you want to do something more complex than insert a simple expression, JSP scriptlets let you insert arbitrary code into the servlet meth...
-
The SQL SELECT statement is used to select data from a SQL database table. This is usually the very first SQL command every SQL newbie learn...
-
Please do this exercise at the command line instead of using NetBeans. This is to learn the concept of packaging without the help of NetBean...
No comments:
Post a Comment