Introduction to Oracle9i – SQL
by Frank4DD, @2004
Writing Basic SQL Select Statements (Module 2)
List the capabilities of SQL SELECT statements
Projection - select specific columns from all rows
Selection - query specific rows from all columns
Join Operations - Combine data between 2 different tables
Execute a basic SELECT statement
syntax:
SELECT *|{[DISTINCT] column|expression [alias],...} FROM table;
example:
SELECT * FROM employees;
explanation:
SELECT identifies what columns, FROM identifies which table.
Differentiate between SQL statements and iSQL*Plus commands
|
SQL |
iSQL*Plus |
|---|---|
|
non-procedural language (statements) |
is an Oracle proprietary environment (commands) |
|
keywords can't be abbreviated |
keywords can be abbreviated |
|
statements manipulate data and table definitions in the database |
commands do not allow manipulation of values in the database |
|
|
Runs in a browser |
Indicate the terms used for column and the row capabilities of select statements from the list below.
(There are two correct answers.)
|
X |
Projection returns the desired columns in a query. |
|
|
Selection returns the desired columns in a query. |
|
X |
Selection returns the desired rows in a query. |
|
|
Restriction eliminates unneeded columns in a query |
|
|
Restriction eliminates unneeded rows in a query. |
|
|
Projection returns the desired rows in a query. |
Choose the correct answer regarding the DESCRIBE syntax:
(There is only one correct answer.)
|
X |
It displays the structure of a database object (like a table), but is not a SQL command. |
|
|
It is a SQL statement that returns the structure of a table. (WRONG!) |
|
|
It displays the format options that have been set for SQLPLUS or iSQLPLUS. |
|
|
It displays the execution plan for a SQL statement. |
Which queries would return a result of 50?
(There are two correct answers.)
|
|
Select (100*(2+50)/5) from dual; |
|
X |
Select (100*2+50)/5 from dual; |
|
X |
Select ((100 *2)+50)/5 from dual; |
|
|
Select (100)*2+(50/5) from dual; |
|
|
Select 100*2 +50/5 from dual; |
For a column alias to contain a space or retain case, it must:
(Choose the best answer)
|
|
Be enclosed within single quotation marks (WRONG!) |
|
|
Be enclosed within curly braces |
|
|
Be enclosed within parenthesis |
|
X |
Be enclosed within double quotation marks |
|
|
Be preceded by the ampersand symbol |
Which of the following statements are true about iSQL*PLUS?
(There are two correct answers.)
|
|
iSQL*PLUS permits its own commands as well as SQL commands to be abbreviated |
|
|
iSQL*PLUS must be installed on the database server as well as each client machine. |
|
X |
iSQL*PLUS runs on an Internet browser, but can be centrally loaded through a URL. |
|
|
iSQL*PLUS is an ANSI standard product for accessing databases. |
|
X |
iSQL*PLUS is an Oracle tool with its own non-SQL commands. |