1 2 >   Sort: Rank

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, 6167👍, 0💬

What Is a SELECT Query Statement
What Is a SELECT Query Statement? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements The SELECT statement is also called the query statement. It is the most frequently used SQL statement in any database application. A SELECT statement allows you to retrieve data from one or more tables, or...
2007-04-21, 4653👍, 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, 5065👍, 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, 4848👍, 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, 4982👍, 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, 4901👍, 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, 6903👍, 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, 5385👍, 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, 4765👍, 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, 4979👍, 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, 4780👍, 0💬

What Are Group Functions
What Are Group Functions? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements Group functions are functions applied to a group of rows. Examples of group functions are: COUNT(*) - Returns the number of rows in the group. MIN(exp) - Returns the minimum value of the expression evaluated on ea...
2007-04-20, 4501👍, 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, 4819👍, 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, 5254👍, 0💬

How To Count Duplicated Values in a Column
How To Count Duplicated Values in a Column? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you have a column with duplicated values, and you want to know what are those duplicated values are and how many duplicates are there for each of those values, you can use the GROUP BY ... HAV...
2007-04-20, 4681👍, 0💬

How To Apply Filtering Criteria at Group Level
How To Apply Filtering Criteria at Group Level? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to return only specific groups from the query, you can apply filtering criteria at the group level by using the HAVING clause inside the GROUP BY clause. The following script give...
2007-04-20, 4575👍, 0💬

Can Group Functions Be Used in the ORDER BY Clause
Can Group Functions Be Used in the ORDER BY Clause? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If the query output is aggregated as groups, you can sort the groups by using group functions in the ORDER BY clause. The following statement returns how many employees are having the sam...
2007-04-20, 4556👍, 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, 4836👍, 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, 4988👍, 0💬

How To Write a Query with an Inner Join
How To Write a Query with an Inner Join? - Oracle DBA FAQ - Understanding SQL SELECT Query Statements If you want to query from two tables with an inner join, you can use the INNER JOIN ... ON clause in the FROM clause. The following query returns output with an inner join from two tables: employees...
2007-04-19, 4653👍, 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, 5346👍, 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, 4931👍, 0💬

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, 6999👍, 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, 4762👍, 0💬

1 2 >   Sort: Rank