1 2 >   Sort: Date

How To Write a Query with a Right Outer Join
How To Write a Query with a Right Outer Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to query from two tables with a right outer join, you can use the RIGHT OUTER JOIN ... ON clause in the FROM clause. The following query returns output with a right outer join from ...
2007-04-19, 6986👍, 0💬

How To Use SELECT Statement to Count the Number of Rows
How To Use SELECT Statement to Count the Number of Rows? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to count the number of rows, you can use the COUNT(*) function in the SELECT clause. The following select statement returns the number of rows in the "department" table: ...
2007-04-20, 6894👍, 0💬

How To Select All Columns of All Rows from a Table
How To Select All Columns of All Rows from a Table? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements The simplest query statement is the one that selects all columns of all rows from a table: "SELECT * FROM table_name;". The (*) in the SELECT clause tells the query to return all columns....
2007-04-21, 6153👍, 0💬

How To Return Top 5 Rows
How To Return Top 5 Rows? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want the query to return only the first 5 rows, you can use the pseudo column called ROWNUM in the WHERE clause. ROWNUM contains the row number of each returning row from the query. The following statement ...
2007-04-18, 5387👍, 0💬

How To Sort Output in Descending Order
How To Sort Output in Descending Order? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to sort a column in descending order, you can specify the DESC keyword in the ORDER BY clause. The following SELECT statement first sorts the department in descending order, then sorts th...
2007-04-20, 5379👍, 0💬

How To Define and Use Table Alias Names
How To Define and Use Table Alias Names? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements When column names need to be prefixed with table names, you can define table alias name and use them to prefix column names as shown in the following select statement: SQL> SELECT e.first_name, e.la...
2007-04-19, 5337👍, 0💬

How To Divide Query Output into Groups
How To Divide Query Output into Groups? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements You can divide query output into multiple groups with the GROUP BY clause. It allows you specify a column as the grouping criteria, so that rows with the same value in the column will be considered a...
2007-04-20, 5249👍, 0💬

How To Name Query Output Columns
How To Name Query Output Columns? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements Each column in the query output has a default name. If you don't like the default name, you can specify a new name for any column in the query output by using the AS clause. The following statement shows y...
2007-04-19, 5066👍, 0💬

How To Select Some Columns from a Table
How To Select Some Columns from a Table? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want explicitly tell the query to some columns, you can specify the column names in SELECT clause. The following select statement returns only two columns from the table "departments": SQL> S...
2007-04-21, 5062👍, 0💬

How To Count Groups Returned with the GROUP BY Clause
How To Count Groups Returned with the GROUP BY Clause? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you use the COUNT(*) function on groups returned with the GROUP BY clause, it will count the number of rows within each group, not the number of groups. If you want to count the num...
2007-04-19, 5017👍, 0💬

How To Write a Left Outer Join with the WHERE Clause
How To Write a Left Outer Join with the WHERE Clause? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you don't want to use the LEFT OUTER JOIN ... ON clause to write a left outer join, you can use a special criteria in the WHERE clause as "left_table.column = right_table.column(+)"....
2007-04-19, 5010👍, 0💬

How To Join Two Tables in a Single Query
How To Join Two Tables in a Single Query? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements Two tables can be joined together in a query in 4 ways: Inner Join: Returns only rows from both tables that satisfy the join condition. Left Outer Join: Returns rows from both tables that satisfy t...
2007-04-20, 4982👍, 0💬

Can the Query Output Be Sorted by Multiple Columns
Can the Query Output Be Sorted by Multiple Columns? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements You can specifying multiple columns in the ORDER BY clause as shown in the following example statement, which returns employees' salaries sorted by department and salary value: SQL> SELEC...
2007-04-20, 4976👍, 0💬

Can SELECT Statements Be Used on Views
Can SELECT Statements Be Used on Views? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements Select (query) statements can used on views in the same way as tables. The following tutorial exercise helps you creating a view and running a query statement on the view: SQL> CREATE VIEW managed_de...
2007-04-20, 4976👍, 0💬

How To Write a Query with a Left Outer Join
How To Write a Query with a Left Outer Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to query from two tables with a left outer join, you can use the LEFT OUTER JOIN ... ON clause in the FROM clause. The following query returns output with a left outer join from two ...
2007-04-19, 4924👍, 0💬

How To Sort the Query Output
How To Sort the Query Output? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want the returning rows to be sorted, you can specify a sorting expression in the ORDER BY clause. The following select statement returns rows sorted by the values in the "manager_id" column: SQL> SELEC...
2007-04-20, 4894👍, 0💬

How To Write an Inner Join with the WHERE Clause
How To Write an Inner Join with the WHERE Clause? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you don't want to use the INNER JOIN ... ON clause to write an inner join, you can put the join condition in the WHERE clause as shown in the following query example: SQL> SELECT d.depar...
2007-04-19, 4879👍, 0💬

How To Select Some Rows from a Table
How To Select Some Rows from a Table? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you don't want select all rows from a table, you can specify a WHERE clause to tell the query to return only the rows that meets the condition defined in the WHERE clause. The following select state...
2007-04-21, 4839👍, 0💬

Can Multiple Columns Be Used in GROUP BY
Can Multiple Columns Be Used in GROUP BY? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements You can use multiple columns in the GROUP BY clause as shown in the following example. It returns how many employees are having the same salary in each department: SQL> SELECT department_id, salary...
2007-04-20, 4831👍, 0💬

Can Group Functions Be Mixed with Non-group Selection Fields
Can Group Functions Be Mixed with Non-group Selection Fields? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If a group function is used in the SELECT clause, all other selection fields must be group level fields. Non-group fields can not be mixed with group fields in the SELECT clause...
2007-04-20, 4815👍, 0💬

How To Use Group Functions in the SELECT Clause
How To Use Group Functions in the SELECT Clause? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If group functions are used in the SELECT clause, they will be used on the rows that meet the query selection criteria, the output of group functions will be returned as output of the query....
2007-04-20, 4771👍, 0💬

How To Filter Out Duplications in the Returning Rows
How To Filter Out Duplications in the Returning Rows? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If there are duplications in the returning rows, and you want to remove the duplications, you can use the keyword DISTINCT or UNIQUE in the SELECT clause. The tutorial exercise below sh...
2007-04-20, 4757👍, 0💬

How To Use Subqueries with the EXISTS Operator
How To Use Subqueries with the EXISTS Operator? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements A subquery can be used with the EXISTS operator as "EXISTS (subquery)", which returns true if the subquery returns one or more rows. The following statement is a good example of "EXISTS (subq...
2007-04-19, 4753👍, 0💬

How To Write a Query with a Full Outer Join
How To Write a Query with a Full Outer Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to query from two tables with a full outer join, you can use the FULL OUTER JOIN ... ON clause in the FROM clause. The following query returns output with a full outer join from two ...
2007-04-19, 4749👍, 0💬

1 2 >   Sort: Date