Oracle Interview
Oracle Interview
Page 1 of 3
The SELECT query is the most often used query in any database.
So , learning this query is very important. Even if you don't write it (http://www.addthis.com/bookmark.php)
manually, as some tools make your task easier by providing code assists. But this query helps you to
understand many aspects of database concepts, ranging from DBA task to PL/SQL. I hope this tutorial
helps learning SELECT query faster and easier.
We will be referring tables from default schema/user SCOTT in Oracle.
The generalized select query looks like :
SELECT
[ DISTINCT| ALL]
{ * | [columnName [ AS newColumnName ] ] ,
[columnName1 [ AS newColumnName1]],
.........,
.........,
}
FROM tableName [ALIAS][,]
[WHERE <condition>]
[GROUP BY columnlist ] [HAVING <condition>]
[ORDER BY columnlist]
We will start with simple query and then keep on building complex queries.
c. Calculate the sum of monthly salary and the commissions of the employee.
SELECT ename,(sal / 12) + nvl(comm,0) AS monthsalwithcomm FROM emp;
Pages:
2 (/database/sql-tutorial/6-select-query?limit=1&start=1)
3 (/database/sql-tutorial/6-select-query?limit=1&start=2)
Prev (/database/sql-tutorial/7-complex-queries-in-sql)