Oracle: Display first name, last name and their salary of employees where column headings will be specified as aliases: FirstName, LastName and Salary
Oracle Basic: Exercise-3 with Solution
Write a query to display first name, last name and their salary of employees where column headings will be specified as aliases: FirstName, LastName and Salary.
Note: To display a column with a new heading, you can rename a column within your report by using an alias immediately after the correct name of the column. This alias effectively renames the item for the duration of the query.
Sample table: employees
Sample Solution:
Oracle Code :
SELECT first_name FirstName, last_name LastName, salary Salary
FROM employees;
Output:
SQL> SELECT first_name FirstName, last_name LastName, salary Salary 2 FROM employees; FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Steven King 24000 Neena Kochhar 17000 Lex De Haan 17000 Alexander Hunold 9000 Bruce Ernst 6000 David Austin 4800 Valli Pataballa 4800 Diana Lorentz 4200 Nancy Greenberg 12008 Daniel Faviet 9000 John Chen 8200 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Ismael Sciarra 7700 Jose Manuel Urman 7800 Luis Popp 6900 Den Raphaely 11000 Alexander Khoo 3100 Shelli Baida 2900 Sigal Tobias 2800 Guy Himuro 2600 Karen Colmenares 2500 Matthew Weiss 8000 Adam Fripp 8200 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Payam Kaufling 7900 Shanta Vollman 6500 Kevin Mourgos 5800 Julia Nayer 3200 Irene Mikkilineni 2700 James Landry 2400 Steven Markle 2200 Laura Bissot 3300 Mozhe Atkinson 2800 James Marlow 2500 TJ Olson 2100 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Jason Mallin 3300 Michael Rogers 2900 Ki Gee 2400 Hazel Philtanker 2200 Renske Ladwig 3600 Stephen Stiles 3200 John Seo 2700 Joshua Patel 2500 Trenna Rajs 3500 Curtis Davies 3100 Randall Matos 2600 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Peter Vargas 2500 John Russell 14000 Karen Partners 13500 Alberto Errazuriz 12000 Gerald Cambrault 11000 Eleni Zlotkey 10500 Peter Tucker 10000 David Bernstein 9500 Peter Hall 9000 Christopher Olsen 8000 Nanette Cambrault 7500 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Oliver Tuvault 7000 Janette King 10000 Patrick Sully 9500 Allan McEwen 9000 Lindsey Smith 8000 Louise Doran 7500 Sarath Sewall 7000 Clara Vishney 10500 Danielle Greene 9500 Mattea Marvins 7200 David Lee 6800 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Sundar Ande 6400 Amit Banda 6200 Lisa Ozer 11500 Harrison Bloom 10000 Tayler Fox 9600 William Smith 7400 Elizabeth Bates 7300 Sundita Kumar 6100 Ellen Abel 11000 Alyssa Hutton 8800 Jonathon Taylor 8600 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Jack Livingston 8400 Kimberely Grant 7000 Charles Johnson 6200 Winston Taylor 3200 Jean Fleaur 3100 Martha Sullivan 2500 Girard Geoni 2800 Nandita Sarchand 4200 Alexis Bull 4100 Julia Dellinger 3400 Anthony Cabrio 3000 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Kelly Chung 3800 Jennifer Dilly 3600 Timothy Gates 2900 Randall Perkins 2500 Sarah Bell 4000 Britney Everett 3900 Samuel McCain 3200 Vance Jones 2800 Alana Walsh 3100 Kevin Feeney 3000 Donald OConnell 2600 FIRSTNAME LASTNAME SALARY -------------------- ------------------------- ---------- Douglas Grant 2600 Jennifer Whalen 4400 Michael Hartstein 13000 Pat Fay 6000 Susan Mavris 6500 Hermann Baer 10000 Shelley Higgins 12008 William Gietz 8300 107 rows selected.
Pictorial Presentation:
Improve this sample solution and post your code through Disqus.
Previous: Write a query to display all the columns of employees table.
Next:Write a query to list first name, last name and their salary for first 10 employee contained in the employees table.
What is the difficulty level of this exercise?
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/oracle-exercises/basic/oracle-basic-exercise-3.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics