Skip to content
Worked Examples · Example 9.3

Q.Select names of all employees along with their annual income (calculated as Salary*12). While displaying the query result, rename the column EName as Name.

Puducherry TnboardTextbookSubjective· 2mImportance★★★★★est
5% · 5/95 Questions
🔒 Locked · start free trial →

You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.

Start your 14-day free trial to unlock the full solution →

Use column aliases (AS) to both compute Annual Income as Salary*12 and rename EName to Name. Run against the chapter's own EMPLOYEE table (Table 9.8), not a generic placeholder table.

An alias is a temporary name assigned to a column (or expression) in the result set — it doesn't change the underlying table, only how the column is displayed. You write it as expression AS alias_name.

The question asks for two things at once:

  1. A computed column: Salary * 12, since annual income isn't stored directly.
  2. A renamed column: EName displayed as Name.
SELECT Ename AS Name, Salary*12 AS 'Annual Income'
FROM EMPLOYEE;

Quoting 'Annual Income' is necessary because the alias contains a space.

Running it on Table 9.8

The EMPLOYEE table was populated earlier in this section (Table 9.8):

EmpNoEnameSalaryBonusDeptId
101Aaliya10000234D02
102Kritika60000123D01
103Shabbir45000566D01
104Gurpreet19000565D04
105Joseph34000875D03
106Sanya48000695D02
107Vergese15000NULLD01
108Nachaobi29000NULLD05
109Daribha42000NULLD04
110Tanya50000467D05

Multiplying every Salary by 12 gives:

+----------+----------------+
| Name     | Annual Income  |
+----------+----------------+
| Aaliya   |         120000 |
| Kritika  |         720000 | …

Unlock everything free for 14 days

  • Full step-by-step solutions
  • Concept-first explanations
  • Methods, shortcuts & mistakes
  • PYQ mapping + timed mock tests

Full access for 14 days. No credit card required.