Selasa, 05 Januari 2016

Final Exam Semester 1

The text below is an example of what constraint type:
The value in the manager_id column of the EMPLOYEES table must match a value in the employee_id column in the EMPLOYEES table.
(4) Referential integrity         

A table must have at least one candidate key, as well as its primary key. True or False?     
(2) False                                                         

A table must have a primary key. True or False?                               
(2) False                                 

If a primary key is a set of columns then one column must be null. True or False?
(2) False
                                   
Attributes become tables in a database. True or False?                                 
(2) False                                                         

In a physical data model, an attribute becomes a _____________.
(4) Column                                                     

The transformation from an ER diagram to a physical design involves changing terminology. Primary Unique Identifiers in the ER diagram become __________ and relationships become ____________.       
(2) Primary keys, Foreign keys

The Oracle Database can implement a many to many relationship. You simply create two foreign keys between the two tables. True or False?
(2) False
                                   
Many to many relationships are implemented via a structure called a: ________________
(2) Intersection Table

An "Arc Implementation" can be done just like any other Relationship - you simply add the required Foreign Keys. True or False?
(2) False                                 

What command will return data from the database to you?
(3) SELECT
                                                           
The DESCRIBE command returns all rows from a table. True or False?
(2) False

What command can be used to create a new row in a table in the database?                       
(4) INSERT               

The f_customers table contains the following data:
ID        Name   Address           City     State    Zip
1          Cole Bee         123 Main Street          Orlando           FL       32838
2          Zoe Twee        1009 Oliver Avenue    Boston MA      02116
3          Sandra Lee      22 Main Street            Tampa FL       32444
If you run the following statement:
DELETE FROM F_CUSTOMERS WHERE ID <= 2;
How many rows will be left in the table?      
(3) 1
                                   
The SQL statement ALTER TABLE EMPLOYEES DELETE COLUMN SALARY is a valid statement. True or False?
(2) False                     

Systems are always just rolled out as soon as the programming phase is finished. No further work is required once the development is finished. True or False?
(2) False                                 

System Documentation is developed right at the end once the system has gone live and users have been using it for a little while. You are more likely to get it correct that way. True or False?    
(2) False                     

Which SQL statement will return an error?
(1) SEL * FR sky;

When you use the SELECT clause to list one or two columns only from a table and no WHERE clause, which SQL capability is used?                              
(3) Projection only

Which statement best describes how arithmetic expressions are handled?
(4) Division and multiplication operations are handled before subtraction and addition operations.                                   

In a SELECT clause, what is the result of 2 + 3 * 2?                                    
(2) 8                

Evaluate this SELECT statement:
SELECT (salary * raise_percent) raise
FROM employees;
If the RAISE_PERCENT column only contains null values, what will the statement return?        
(2) Only null values    

Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL query?
(1) AS                        

You need to display employees with salaries that are at least 30000 or higher. Which comparison operator should you use?         
(3) >=                         

You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use?
(3) BETWEEN...AND...
           
Which symbol represents the not equal to condition?                                   
(3) !=
                                   
The Concatenation Operator does which of the following?                          
(2) Links two or more columns or literals to form a single output column

You need to display all the rows in the EMPLOYEES table that contain a null value in the DEPARTMENT_ID column. Which comparison operator should you use?
(4) IS NULL              

What does the DISTINCT keyword do when it is used in a SELECT clause?        
(3) Eliminates duplicate rows in the result

You need to display all the values in the EMAIL column that contains the underscore (_) character as part of that email address. The WHERE clause in your SELECT statement contains the LIKE operator. What must you include in the LIKE operator?
(4) The ESCAPE option (\)

You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values?
(3) IN                         

You want to determine the orders that have been placed by customers who reside in Chicago. You write this partial SELECT statement:
SELECT orderid, orderdate, total
FROM orders;
What should you include in your SELECT statement to achieve the desired results?
(3) WHERE city = 'Chicago';                                                

What will be the result of the SELECT statement and what will display?
SELECT last_name, salary, salary + 300
FROM employees;                 
(1) Display the last name, salary and the results of adding 300 to each salary for all the employees                                                            
When is an entity in 2nd Normal Form?
(1) When all non-UID attributes are dependent upon the entire UID.

Would it be a good idea to model age as an attribute of STUDENT?
(4) No - it breaks the Normalization rules

Which comparison condition means "Less Than or Equal To"?
(4) "<="                      

Which of the following best describes the meaning of the LIKE operator?
(3) Match a character pattern.                                                

You need to change the default sort order of the ORDER BY clause so that the data is displayed in reverse alphabetical order. Which keyword should you include in the ORDER BY clause?
(1) DESC                                                       

Which clause would you include in a SELECT statement to sort the rows returned by the LAST_NAME column?
(1) ORDER BY

The ORDER BY clause always comes last. True or False?
(1) True                                  

Which of the following are TRUE regarding the logical AND operator?                             
(4) TRUE AND FALSE return FALSE                                                        

Evaluate this SELECT statement:
SELECT last_name, first_name, salary
FROM employees;
How will the results of this query be sorted?
(1) The database will display the rows in whatever order it finds it in the database, so no particular order.                                                            
Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?   
(1) IN                                     

Evaluate this SELECT statement:
SELECT first_name, last_name, email
FROM employees
ORDER BY last_name;
Which statement is true?
(2) The rows will be sorted alphabetically by the LAST_NAME values.

What value will the following SQL statement return?
SELECT employee_id
FROM employees
WHERE employee_id BETWEEN 100 AND 150 OR employee_id IN(119, 175, 205) AND (employee_id BETWEEN 150 AND 200);
(3) 100, 101, 102, 103, 104, 107, 124, 141, 142, 143, 144, 149
                                                        
Evaluate this SELECT statement:
SELECT employee_id, last_name, first_name, salary 'Yearly Salary'
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
Which clause contains an error?         
(1) SELECT employee_id, last_name, first_name, salary 'Yearly Salary'  
                                                   
The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9) PK
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
DEPARTMENT_ID NUMBER(9)
Compare these two SQL statements:
1. SELECT DISTINCT department_id DEPT, last_name, first_name FROM employees ORDER BY department_id;
2. SELECT department_id DEPT, last_name, first_name FROM employees ORDER BY DEPT;
How will the results differ?                           
(3) There is no difference in the result between the two statements.    
                                            
The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You must display the player name, team id, and salary for players whose salary is in the range from 25000 through 100000 and whose team id is in the range of 1200 through 1500. The results must be sorted by team id from lowest to highest and then further sorted by salary from highest to lowest. Which statement should you use to display the desired result?
(2) SELECT last_name, first_name, team_id, salary
FROM players
WHERE salary BETWEEN 25000 AND 100000
AND team_id BETWEEN 1200 AND 1500
ORDER BY team_id, salary DESC;                         
The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)

You want to display all players' names with position 6900 or greater. You want the players names to be displayed alphabetically by last name and then by first name. Which statement should you use to achieve the required results?                       
(1) SELECT last_name, first_name
FROM players
WHERE position_id >= 6900
ORDER BY last_name, first_name;

The explanation below is a column integrity constraint:
A column must contain only values consistent with the defined data format of the column. True or False?
(1) True

Identify all of the incorrect statements that complete this sentence: A primary key is: 
(1) A single column that uniquely identifies each column in a table
(3) A set of columns in one table that uniquely identifies each row in another table
(4) Only one column that must be null

The explanation below is a User Defined integrity rule and must therefore be manually coded, the Database cannot enforce this rule automatically:
A primary key must be unique, and no part of the primary key can be null. True or False?
(2) False

The text below is an example of what constraint type:
The value in the manager_id column of the EMPLOYEES table must match a value in the employee_id column in the EMPLOYEES table.
(4) Referential integrity

In a physical data model, an attribute becomes a _____________. 
(4) Column 

The transformation from an ER diagram to a physical design involves changing terminology. Primary Unique Identifiers in the ER diagram become __________ and relationships become ____________. 
(2) Primary keys, Foreign keys 

In a physical data model, a relationship is represented as a combination of: 
(2) Primary Key or Unique Key 
(4) Foreign Key

It is possible to implement non-transferability via a simple Foreign Key Relationship. True or False? 
(2) False

Many to many relationships are implemented via a structure called a: ________________ 
(2) Intersection Table 

When mapping supertypes, relationships at the supertype level transform as usual. Relationships at subtype level are implemented as foreign keys, but the foreign key columns all become mandatory. True or False? 
(2) False

Which of the following are reasons why you should consider using a Subtype Implementation?
(3) Business functionality and business rules, access paths and frequency of access are all very different between subtypes. 

The _______ clause can be added to a SELECT statement to return a subset of the data. 
(3) WHERE 

The DESCRIBE command returns all rows from a table. True or False?
(2) False

Which SQL keyword specifies that an alias will be substituted for a column name in the output of a SQL query? 
(1) AS

You query the database with this SQL statement:
SELECT *
FROM transaction
WHERE product_id = 4569;
Which SQL SELECT statement capabilities are achieved when this statement is executed?
(1) Selection only 

Evaluate this SELECT statement:
SELECT (salary * raise_percent) raise
FROM employees;
If the RAISE_PERCENT column only contains null values, what will the statement return?
(2) Only null values 

What would you use in the SELECT clause to return all the columns in the table?
(1) An asterisk (*)

When you use the SELECT clause to list one or two columns only from a table and no WHERE clause, which SQL capability is used?
(3) Projection only 

In a SELECT clause, what is the result of 2 + 3 * 2?
(2) 8

You query the database with this SQL statement:
SELECT * FROM students;
Why would you use this statement?
(2) To view data 

Any Non-UID must be dependant on the entire UID. True or False?
(1) True 

When is an entity in 2nd Normal Form?
(1) When all non-UID attributes are dependent upon the entire UID.

What does the DISTINCT keyword do when it is used in a SELECT clause?
(3) Eliminates duplicate rows in the result

Which symbol represents the not equal to condition?
(3) !=

Which statement best describes how column headings are displayed by default in Oracle Application Express: 
(3) Column headings are displayed centered and in uppercase. 

Which operator is used to combine columns of character strings to other columns?
(4) ||

You need to display employees whose salary is in the range of 30000 and 50000. Which comparison operator should you use? 
(3) BETWEEN...AND... 

Which clause would you include in a SELECT statement to restrict the data returned to only the employees in department 10?
(1) WHERE 

Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_id IN(10, 20, 30)
AND salary > 20000;
Which values would cause the logical condition to return TRUE?
(4) DEPARTMENT_ID = 10 and SALARY = 20001

What will the result of the following SELECT statement be:
SELECT last_name, salary, salary + 300
FROM employees;
How will the heading for the SALARY column appear in the display by default in Oracle Application Express?
(1) Display the last name, salary and the results of adding 300 to each salary for all the employees

The PLAYERS table contains these columns:
PLAYER_ID NUMBER(9)
LAST_NAME VARCHAR2(20)
FIRST_NAME VARCHAR2 (20)
TEAM_ID NUMBER (4)
MANAGER_ID NUMBER (9)
POSITION_ID NUMBER (4)
Which SELECT statement should you use if you want to display unique combinations of the TEAM_ID and MANAGER_ID columns?
(3) SELECT DISTINCT team_id, manager_id FROM players; 

You need write a SELECT statement that should only return rows that contain 34, 46, or 48 for the DEPARTMENT_ID column. Which operator should you use in the WHERE clause to compare the DEPARTMENT_ID column to this specific list of values?
 (3) IN

Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table?
(2) SELECT manager_id, department_id FROM employees; 

The EMPLOYEES table contains these columns:
EMPLOYEE_ID NUMBER(9) PrimaryKey
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
DEPARTMENT_ID NUMBER(5) NOT NULL
MANAGER_ID NUMBER(9) NOT NULL
Evaluate these two SELECT statements:
1. SELECT DISTINCT employee_id, department_id, manager_id FROM employees;
2. SELECT employee_id, department_id, manager_id FROM employees;
Which of the following statements is true?
(1) The two statements will display the same data.

The STUDENT table contains these columns:
STUDENT_ID NUMBER(10) Primary Key
LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)
MAIN_SUBJECT_ID NUMBER(3)
ADVISOR_ID NUMBER(5)
Evaluate this statement:
SELECT DISTINCT advisor_id, main_subject_id
FROM student;
Which statement is true?
(2) Each MAIN_SUBJECT_ID can be displayed more than once per ADVISOR_ID. 

The EMPLOYEES table includes these columns:
EMPLOYEE_ID NUMBER(4) NOT NULL
LAST_NAME VARCHAR2(15) NOT NULL
FIRST_NAME VARCHAR2(10) NOT NULL
HIRE_DATE DATE NOT NULL
You want to produce a report that provides the first names, last names and hire dates of those employees who were hired between March 1, 2000, and August 30, 2000. Which statements can you issue to accomplish this task?
(1)SELECT last_name, first_name, hire_date
FROM employees
WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00';

Evaluate this SQL statement:
SELECT e.employee_id, e.last_name, e.first_name, m.manager_id
FROM employees e, employees m
ORDER BY e.last_name, e.first_name
WHERE e.employee_id = m.manager_id;
This statement fails when executed. Which change will correct the problem?
(1) Reorder the clauses in the query. 

The PLAYERS table contains these columns:
PLAYERS TABLE:
LAST_NAME VARCHAR2 (20)
FIRST_NAME VARCHAR2 (20)
SALARY NUMBER(8,2)
TEAM_ID NUMBER(4)
MANAGER_ID NUMBER(9)
POSITION_ID NUMBER(4)
You want to display all players' names with position 6900 or greater. You want the players names to be displayed alphabetically by last name and then by first name. Which statement should you use to achieve the required results?
(1) SELECT last_name, first_name
FROM players
WHERE position_id >= 6900
ORDER BY last_name, first_name;

Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE salary > 30000
AND department_id = 10
OR email IS NOT NULL;
Which statement is true?
(2) The AND condition will be evaluated before the OR condition.

Evaluate this SELECT statement:
SELECT *
FROM employees
WHERE department_id = 34
OR department_id = 45
OR department_id = 67;
Which operator is the equivalent of the OR conditions used in this SELECT statement?
(1) IN

You need to create a report to display all employees that were hired on or after January 1, 1996. The data should display in this format:
Employee Start Date and Salary
14837 - Smith 10-MAY-92 / 5000
Which SELECT statement could you use?
(5) SELECT employee_id ||' - '|| last_name "Employee",
hire_date ||' / '|| salary "Start Date and Salary"
FROM employees
WHERE hire_date <= '01-JAN-96';

You attempt to query the database with this SQL statement:
SELECT product_id "Product Number", category_id "Category", price "Price"
FROM products
WHERE "Category" = 5570
ORDER BY "Product Number";
This statement fails when executed. Which clause contains a syntax error?
(4) WHERE "Category" = 5570

Evaluate this SELECT statement:
SELECT employee_id, last_name, first_name, salary 'Yearly Salary'
FROM employees
WHERE salary IS NOT NULL
ORDER BY last_name, 3;
Which clause contains an error?
(1) SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*)

Evaluate this SELECT statement:
SELECT last_name, first_name, department_id, manager_id
FROM employees;
You need to sort data by manager id values and then alphabetically by employee last name and first name values. Which ORDER BY clause could you use?
(2) ORDER BY manager_id, last_name, first_name 

Which statement about the logical operators is true? 
(4) The order of operator precedence is NOT, AND, and OR. (*)

Which comparison condition means "Less Than or Equal To?" 
(4) "<=" 

From left to right, what is the correct order of Precedence?
(1) Arithmetic, Concatenation, Comparison, OR

Which statement about the ORDER BY clause is true? 
(1) You can use a column alias in the ORDER BY clause.

Which clause would you include in a SELECT statement to sort the rows returned by the LAST_NAME column?
(1) ORDER BY

You need to change the default sort order of the ORDER BY clause so that the data is displayed in reverse alphabetical order. Which keyword should you include in the ORDER BY clause?
(1) DESC

A foreign key cannot refer to a primary key in the same table. True or False?
(2) False

What do you create when you transform a many to many relationship from your ER diagram into a physical design?
(3) Intersection table
           
In the default order of precedence, which operator would be evaluated first?        
(2) Multiplications and Division are at the same level and would be evaluated first based on left to right order
           
The EMPLOYEES table contains these columns:
SALARY NUMBER(7,2) BONUS NUMBER(7,2) COMMISSION_PCT NUMBER(2,2)
All three columns contain values greater than zero. There is one row of data in the table and the values are as follows: Salary = 500, Bonus = 50, Commission_pct = .5
Evaluate these two SQL statements:
1. SELECT salary + bonus + commission_pct * salary - bonus AS income FROM employees;
2. SELECT (salary + bonus ) + commission_pct * (salary - bonus) income FROM employees;
What will be the result?         
(2) Statement 2 will return a higher value than statement 1.

Where in a SQL statement can you not use arithmetic operators?
(2) FROM      

You need to combine the FIRST_NAME and LAST_NAME columns in the EMPLOYEES table and display the columns as a combined character string. Which operator should you use?   
(3) ||    

Evaluate this SELECT statement:
SELECT last_name, first_name, salary FROM employees;
How will the heading for the SALARY column appear in the display by default in Oracle Application Express?
(3) The heading will display as uppercase and centered.

Which logical operator returns TRUE if either condition is true?
(1) OR

Evaluate this SQL statement:
SELECT product_id, product_name, price FROM products ORDER BY product_name, price;
What occurs when the statement is executed?
(4) The results are sorted alphabetically and then numerically.

Once you have created a table, it is not possible to alter the definition of it. If you need to add a new column you must delete the table definition and create a new, correct table. True or False?       
(2) False
           
In the analysis phase the tables are created and populated with test data. True or False?
(2) False
 
 
 
 
 
sumur : http://quizoracle.blogspot.co.id
"Satrio Pinandito Sinisihan Wahyu"