177 terms

TSTC ITSE 1345 - Oracle SQL Final Exam Review

TSTC Waco ITSE 1345 - Oracle SQL Final Exam Review Summer 2011
Explain how LINESIZE, PAGESIZE, and FEEDBACK affect the output of your script
LINESIZE - command determines the total number of characters SQL *Plus displays in on line before beginning a new line.
PAGESIZE - default is 14; when you use the default, you repeat the heading every 14 rows.
FEEDBACK - command returns the number of records returned by a query.
Explain how Substitution Variables are used when writing scripts.
When you want to run the same script repeatedly, but want to be able to change a variable you would use a substitution variable. During the execution of the script the user will be prompted to input the variable to use.
Explain how the SPOOL command is used and what program it can be used in.
The SPOOL command, together with a file name, spools any subsequently issued SQL Plus or SQL command to a file. Just as with other file names, you can add a path to store the file in a directory other than your SQL Plus default directory. SQL Developer does not allow for spooling.
Explain the steps needed to run a script in SQL Developer
Load the file into the SQL Statement Box, by opening the location the file is stored and inserting it into the statement Box. Next you can press the F5 key.
Explain what a static data dictionary view is and how it is used
The static data dictionary stores details about database objects, such as tables, indexes, and views. Whenever a new object is added or an object is changed, data about the object is recorded in the data dictionary.
Explain what is found in the All Objects report folder in SQL Developer
Lists all objects accessible for the chosen database connection. Also lists a helpful dependencies report for accessing change impact.
List the different types of data dictionary views.
USER_, ALL_, DBA_, and V$
Write a statement for SQL*Plus that shows the dictionary.
DESC dict;
SELECT LIST of a subquery in an INSERT statement
SET clause of an UPDATE statement
Is The following statement is correct:
FROM instructor
ORDER BY phone
What does the following function return? SELECT LENGTH(NULL),
FROM dual
_________ and __________ functions are opposites of each other and provide a value in a group of rows.
Both MIN and MAX
_________ rows are not allowed in the relational model.
___________ subqueries allow you to reference columns from the outer query and execute the inner query repeatedly
____________ are useful for analyzing and exploring the relationships within your data
_________________ relationships are always optional relationships.
__________________ inserts the current date and time.
A _____ is a query definition stored in the database that looks just like a table, but does not have any physical rows
A _________ subquery returns a single column with a single row
A calculation with a null always yields another null.
A constraint must have a name in order for it to be disabled.
A DML command automatically issues a COMMIT.
A function that operates on a single value can have only one input parameter.
A join across three tables can be expressed with the ________ join syntax.
A space or value of zero is the same as NULL in a schema diagram
A transaction is a logical unit of work.
All SQL statements contained within a script must end with a semicolon or forward slash, even if they are done in SQL Developer.
An outer join includes the result rows returned by an __________ plus extra rows where no matches are found.
Another name for a data dictionary view is __________________ or _________________.
static or dynamic
Checks whether any value in the list makes the condition true.
Checks whether any value in the list makes the condition true.
Comparison operators can compare multiple _________________.
Converting a text literal to DATE format requires the use of the TO_CHAR function.
Dynamic views begin with a ___________.
Explain Flashback queries and how they are used. Give an example of a FLASHBACK_TRANSACTION query and explain what it does row by row.
Orable's flashback query feature allows you to look at values of a query at a specific time in the past, such as before specfic DML statements occured. This can be usefull in case a suer accidentally performs an unintended but committed DML change. It can also be useful if you want to compare previous data to current data.
Explain how Dynamic SQL is used and give an example of a Dynamic SQL statement.
Dynamic SQL is used to be continuously updated by the background processes in the Oracle instance but never by the user.
Explain how Oracle treats locks when a database is being updated and needs to be viewed by other users.
When you issue a INSERT, UPDATE, DELETE, or MERGE statement, Oracle automatically locks the modified rows. The lock prevents other sessions from making changes to these rows. The lock is released when the session initiating change commits or rollsback.
Explain how you can optimize your queries with subqueries and the main advantage of doing so.
Subqueries allow you to nest multiple queries into each other. This gives you the ability to use one statement to break down a problem into individual components. Without nesting queries, you would be required to have multiple queries which could be time consuming and difficult to accomplish. With the ability to nest queries you can breakdown results to get the results you were needing in one statement.
Explain in detail the impact of INDEXES and how they are used by Oracle.
To achieve good performance for data retrieval and data manipulation statements Oracle uses indexes. In the same way you would use an index in the back of a book to quickly find information, Oracle uses indexes to speed up data retrieval. If the appropriate index does not exist on a table, Oracle needs to examine every row (called a full table scan), which can be time consuming.
Explain the differences in how an ANSI Full Outer Join and a Full Outer Join using the UNION Operator work
Explain why constraints are used when building tables.
Constraints are used to enforce the business rules of a system. For instance, "The salary of an employee may not be a negative number" may be enforced with a check constraint on the salary column. Constraints also ensure integrity and data consistency among all applications, no matter which program and ease the burden of programming the business rules in individual applications because the database enforces the constraint.
Explicit data type conversion is preferable to Oracle's implicit conversion.
How many characters can be stored in the CHAR column/field?
How many characters can you have using the VARCHAR data type?
If a graphical representation of a table's box has __________ it means that the relationship is identifying.
rounded edges
If you are running a version of Oracle that is prior to 9i, it is best to use the ANSI Outer join.
In a view you can give a column a different name than it has in the parent table.
In SQL Developer field names and table names are shown in the color _______.
Information that is returned after you run your statement are found in the __________ tab in SQL Developer.
Instead of using the Oracle Outer Join Operator or the ANSI syntax, you can achieve the same result with two SQL statements: ____________ and a ____________
Equijoin and correlated subquery
It is always good practice to include the old values in the WHERE clause of UPDATE to ensure that another session or user has not changed the name in the meantime.
It is common practice to place a HAVING clause before the GROUP BY clause.
It is considered good form to put all SQL commands in all caps.
It is not possible to limit or disable constraints using Dynamic SQL scripting.
Joins involving multiple columns must always follow the primary key/foreign key relationship path.
List 4 aggregate functions
COUNT(registration_date), AVG (capacity), MIN (capacity), MAX (capacity)
List 6 Table-Related Menu Choices
List the reasons that a subquery could not be unnested.
List the steps performed by a correlated subquery.
**** Select a row from the outer query, Determine the value of the correlated column, Execute the inner query for each record of the outer query., Feed the results of the inner query to the outer query and evaluate it. It if satisfies the criteria, return the row for output.Select the next record of the outer query and repeat steps 2 through 4 until all the records of the outer query are evaluated.
Match each of the SQL commands on the left with a verb from the list.
Control - Revoke
Manipulate - MERGE
NUMBER functions can be nested
Oracle prefers that you use the unique index syntax for future compatibility.
Oracle uses the outer join operator to indicate that nulls are shown for non-matching rows.
Primary key values should always be subject to frequent change.
Queries that are found in parentheses are done first, just as in the order of operations when doing mathematical equations.
Returns rows if the condition is true for all the values in the list
Self-joins are useful for performing comparisons and checking for inconsistencies in data.
SQL Developer provides an extensive list of useful reports and offers the capability to create your own user-defined reports
SQL Developer's ____________________ option allows you to selectively export certain rows and columns.
Export Data
SQL*Plus is used more than SQL Developer when you need to run scripts.
Subqueries can return multiple rows.
Substitution variables are limited to the WHERE clause of a statement.
The ______ operator compares a list of values for equivalency
The _______ function adds values together for a group of rows.
The _______ operator determines common rows.
The ________ operator cannot compare against a list of values.
The __________ operator is inclusive of the two values specified.
The ___________ operator tests whether a matching row cannot be found.
The ____________ clause on a CREATE TABLE statement can specify how much space to allocate.
The ____________ command makes changes permanent.
The ____________ icon allows you to execute multiple statements and emulates SQL *Plus as much as possible.
The ____________ keywords and the USING clause of the ANSI join syntax are mutually exclusive.
The _____________ clause determines how rows are grouped.
The ________________ is a type of statement whereby you retrieve data that exists in one table, but not in another.
The ALL operator returns true if any value in the list satisfies the condition.
The ALTER SESSION statement can change the session's time zone.
The bitmap index is the most common index structure in Oracle.
The common column used in the join condition must be listed in the SELECT list.
The COUNT function is useful for determining whether a table has data.
The COUNT function uses the __________ wildcard.
The crow's foot depicts the M of a 1:M relationship.
The data dictionary is used by Oracle externally to build diagrams.
The Data tab in SQL Developer allows you to perform all the major DML commands, using the SQL *Plus interface.
The data type definitions NUMBER(10) and NUMBER(10,0) are the same.
The DECODE function lets you perform if-then-else functionality with the SQL language.
The DUAL table can be used for testing functions.
The eraser icon removes all statements in SQL *Plus
The EXISTS operator can return True, False or Unknown
The focus of the logical data model is _____________
business problems
The INSERT statement creates new data in a table only through single rows.
The key that most database designers prefer and is chosen by the system is the _____________ key.
The lack of a unique index key is frequently the reason for slow performance of updates and deletions
The MIN and MAX functions cannot take other data types as parameters.
The MINUS operator shows likenesses between sets of rows.
The NEXTVAL and CURRVAL pseudocolumns can be used in which of the following SQL constructs? Select all that apply.
VALUES clause of an INSERT statement
The Nonequijoin can use the ________________ operator to construct joins that are not based on equality of values.
The number of rows in a table matches the number of columns
The ORDER BY clause is allowed in subqueries.
The purpose of the HAVING clause is to eliminate___________.
The query retrieves more than 5 to 15 percent of the rows
The indexed column is part of an expression. In this case, consider creating a function-based index instead
The ROUND function can take only the NUMBER data type as a parameter
The ROWID pseudocolumn is not an actual column, but it acts like one.
The RTRIM function is useful for eliminating extra spaces in a string.
The same function can be used twice in a SELECT statement.
The SELECT command always places locks on retrieved rows.
The self join is different from other joins because it does not utilize a primary key or a foreign key.
The surrogate key generated by a sequence is often used by the DBA and is changed often.
The term ____________ ___________ is used to express a join that satisfies the join condition.
The time zone displacement value indicates the time difference from _______.
The TIMESTAMP WITH LOCAL TIME ZONE data type allows fractional seconds.
The TRUNC function on a date without a format model truncates the timestamp to 12:00:00 A.M.
The using clause of the ANSI join syntax always assumes an equijoin and identical column names.
To equijoin a table with another table involves matching the common column value.
To join four tables, you must have at least three join conditions.
To place a line comment in your SQL statements, you first place a // at the beginning of the line.
To restart a sequence at a lower number, you can drop and re-create the sequence.
To revert back to a state that happened before you ran your change statement, you issue a ____________ command.
UNION ALL does not sort, therefore it is less time consuming to use than the UNION operator.
Users can only see changes made to a database once they have been committed.
Usually a script only needs to be run and tested one time to make sure that it is functional.
What are the main components of a ROWID?
The main components of a ROWID are the data object number, the number of the data block, the numbers of rows within the data block, and the data file number.
What do views do that makes them so useful for security?
hide data
What does SQL stand for?
Structured Query Language
What is Oracle's most popular index storage structure?
B-Tree Index
What is the command you would type into SQL*Plus if you needed to know the definition for each column of a table?
What is the data type you can use if you need an unlimited number of textual characters?
What is the first column of a composite index called?
What is the keyboard shortcut for the ROLLBACK command?
What is the main difference between the NOT EXISTS and the NOT IN operators?
The way NULL values are treated
What is the maximum value for a column defined as NUMBER(4,2)?
What is the most common DATE format found in SQL?
What is the name of the key automatically generated from a sequence?
surrogate key
What is the name of the view where you can find the collection of static and data dictionary tables and views, along with their descriptions?
What is the Oracle data dictionary called that contains a set of tables and views containing the data about the database?
What is the syntax used to indicate that you are using the Oracle Outer Join operator?
What is the tab in SQL Developer where data dictionary view information can be found?
When column names on the tables are different, you use the ______ condition.
When disabling a unique or primary key, you can keep the index if you specify the __________________ clause in the ALTER TABLE statement.
When is it not a good idea to use an index?
When the table is small (unless your business rules require you too)
When returning multiple rows, a subquery must contain the _____, _____, _____, or ______ operator, otherwise Oracle will return an error
When using the data NUMBER(10,4) there will be _______ digits following the decimal point.
When using the following data: NUMBER(10,4) - the # 10 is called the __________.
When using the following data: NUMBER(10,4) - the # 4 is called the __________.
When using the following data: NUMBER(10,4) - the lowest number you can possibly have is __________.
When writing an ANSI outer join, the keywords _________ OUTER and _________ OUTER are added to the __________ keyword to indicate the rows from which table to use.
When writing the syntax for finding information on three or more tables, the parenthesis around the ON clause is optional.
When you create a report in SQL Developer all the column names must match identically the names of the columns found in the tables you are referencing.
When you have issued a DELETE command, you can still retrieve those rows and restore the information.
When you INSERT new information into a table, it is followed with a _______ keyword that contains the information that is going to be added to the table.
When you run a script in SQL*Plus you must give the location of the file.
When you want to run a script in either SQL*Plus or SQL Developer, you can use a ______ or the _________ command.
@ or START
Which format mask displays December 31st, 1999?
Month ddth, yyyy
Which one of the following string functions tells you how many characters are in a string?
Which operator is most commonly used?
Write a solution that adds 20 minutes to a given date.
FROM dual
Write a statement that drops the index need_to_pass_i
DROP INDEX need_to_pass_i
Write an SQL statement for SQL *Plus in which you want any unique menu items to be displayed from the restaurant table
FROM restaurant
Write the syntax to rename index just_two_more_weeks_i to finally_i
RENAME just_two_more_weeks TO finally_i
You can combine DISTINCT and a GROUP BY clause in the same SELECT statement.
You can pass parameters from the operating system when running a script file in SQl*Plus
You can simplify the writing of SQL statements by writing SQL _________ that generate and execute other SQL statements.
You can use the ADD_MONTHS functi0n to subtract months from a given date.
You cannot create a table from another table if it has no rows.
You must explicitly indicate whether an ORDER BY clause is ascending.
You must ORDER BY a column listed on your SELECT statement.
You use the _________ keyword to add columns or constraints to a table.
You use the __________ keyword to change characteristics of a column.