CIS 143 Introduction to SQL Quiz 2
Student Name ________________________________________ Section ___ Date _______
Part I – MULTIPLE CHOICE AND SHORT ANSWER PORTION
1. The following is the correct code to create a view:
a. CREATE VIEW kljview AS b. CREATE OR REPLACE VIEW kljview
c. CREATE kljview d. REPLACE VIEW kljview
2. Which of the following is/are correct to give an alias for a column? Use the table Dual to check your answer!
a. SELECT sysdate ”Bach” s’ ” Home”
b. SELECT sysdate ‘Beethoven’s Home’
c. SELECT sysdate ”Brahms”s Home”
d. SELECT sysdate ‘Mozart’ Home’
e. SELECT sysdate ”Katherine’s Home”
3. Choose which letter accurately describes the relationship of the following entities
Patient
Doctor
a. 0:0 b. 1:0 c. 1:1 d. 1:M e. M:M
4. The SQL code: SELECT &last_name, &first_name from employees;
a. involve substitution variables
b. asks for direct user input
c. will be ignored by the server
d. a and b
e. b and c
5. Marge enters the following date in RR format for the employees date of birth: 25-Dec-25
Marge enters this information on September 26th, 2051. What is the year of birth as recognized by Oracle? [be careful on this one! Do your research!!]
a. 2025 b. 2005 c. 1925 d. 1905 e. 2125
6. Only primary and foreign keys have the constraint NULL.
a. True b. False
7. The column heading is used to customize what the reader will see for the name of the column field.
a. True b. False
8. To determine the total of all the employees of department_id = 90 using the table called employees, the SQL code is
SELECT TOTAL(last_NAME) FROM employees WHERE department_id=90;
a. True b. False
9. What does the following query yield?
SELECT last_name, first_name, Oracle_test_score, date_test
FROM students
Where Oracle_test_score > (SELECT AVG(Oracle_test_score) from students)
10. Concatenate the result returned by the following number functions. Be sure to show the sql code, along with the query results!
ROUND(222.199,-2), TRUNC(222.199,-2)
11. What are the number of days to reach the day after December 1st, 2021? Be sure to show the sql code, along with the query results!
12. What is the proper code to format a column that contains numbers to represent currency? Once you have determined the format, use the code to format the number 500 to represent currency to the second decimal.
13. Give the code to concatenate the following two fields: Book_ID, Book_Desc
14. Name at least two reasons to construct a View.
15. Give two examples of using the CHECK constraint, one example of using the NULL constraint, and one example using the UNIQUE constraint. You may construct a table to show these constraints assigned to any fields for the table.
Part II – Payroll Problem!
Create a Payroll table for the ORACO Company that will contain the following field schema as of 10/31/2011, and populate the table [note the last row is to include your name and todays date]. You may name the table payroll. BY THE WAY, THE TABLE HAS BEEN CREATED FOR YOU AND IS FOUND IN THE EXAM FOLDER!!
Recent Comments