Oracle__4. Oracle 1Z0-051 Exam - Select Statement Flashcards
What is the simplest syntax for the SELECT clause to return all fields of a table?
SELECT *
What is the simplest syntax for the SELECT clause to return all unique fields of a table?
SELECT DISTINCT *
What default keyword in the SELECT clause will return all rows including duplicates?
ALLSyntax: SELECT ALL *The keyword ALL is default
What is a clause?
a subset of a command that modifies the command.
What is the correct order of the following clauses in a select statement? ORDER BY SELECT WHERE HAVING GROUP BY
SELECTFROMWHEREGROUP BYHAVINGORDER BY
If table aliases are created in the FROM clause what other clauses can use those aliases?
SELECTWHEREGROUP BYORDER BY
What is the syntax of an ORDER BY clause to display column2 in alphabetical order and column1 in reverse numeric order?
ORDER BY column2 DESC, column1alsoORDER BY 2 DESC, 1
What does ORDER BY 1, 2 mean?
The first column in the select clause is ordered first and then the second column is order within the values of the first column.
What is the keyword in the ORDER BY clause meaning to sort from lowest to highest?
ASCmeaning AscendingASC is the default
What keyword will only display the first 10 rows of a SELECT statement?
WHERE ROWNUM <= 10
What is the syntax of a Select statement if you are adding column1 + column2 but want to have the column name as SUM?
SELECT column1 + column2 AS SUMthe as is optional but recommended
How many columns will be returned from this SELECT clause? Select column1 column2 from T1
1 column which will have the column name (Alias) of Column2.
What is the FROM clause syntax for creating an alias ‘X’ for a table named Table1
FROM table1 AS XThe keyword AS is optional
If column aliases are created in the SELECT clause which other clause CANNOT use those aliases?
GROUP BY
What is the only clause that you can create table aliases?
FROM
What is the only clause that you can create column aliases?
SELECT
What will be the difference of the returned data between these 2 clauses? ORDER BY column1, column2 ORDER BY 1, 2
Identical results
If column aliases are created in the SELECT clause which other clause CAN use those column aliases?
ORDER BY
Will this statement execute without errors? SELECT column1 A, column2 B, column1 + column2 C FROM table GROUP by column1, column2, column1 + column2
This will execute without errorsThe column1 + column2 in the GROUP BY is necessary and will error without it.
Which clause from a SELECT statement is used to eliminate rows from the results?
WHERE
Which clause from a SELECT statement is used to eliminate groups from the results?
HAVING
what is returned from the following statement? SELECT 2*5 + 7 - 6/2 FROM DUAL
142*5 = 106/2 = 310+7-3 = 14
What is DUAL?
a table in ORACLE that has one column named DUMMY with a value of X
Are the following statement equal? SELECT * FROM EMPLOYEES; Select * FROM EMPLOYEES; select * FROM EMPLOYEES;
Yes. Keyword capitalization of keywords has no affect.