Sunteți pe pagina 1din 6

Section 12 1. A table must have at least one candidate key, as well as its primary key. True or False?

Mark for Review False (*) 2. A table must have a primary key. True or False? Mark for Review False (*) 3. Entity integrity refers to Mark for Review Tables having Primary Keys, Foreign Keys, Unique Keys and Check constraints defined in the database. (*) 4. 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? False (*) 5. Which of the following are reasons why you should consider using a Subtype Implementation? Mark for Review Business functionality and business rules, access paths and frequency of access are all very different between subtypes. (*) 6. An "Arc Implementation" can be done just like any other Relationship - you simply add the required Foreign Keys. True or False? Mark for Review False (*) 7. One-to-One relationships are transformed into Check Constraints in the tables created at either end of that relationship. True or False? Mark for Review False (*) 8. What do you create when you transform a many to many relationship from your ER diagram into a physical design? Mark for Review (Intersection table (*) 9. In a physical data model, a relationship is represented as a combination of: (Choose Two) Primary Key or Unique Key (*) Foreign Key (*) 10. Attributes become tables in a database. True or False? Mark for Review False (*) 11. In a physical data model, an attribute becomes a _____________. Mark for Review Column (*) Section 13 12. What command will return data from the database to you? Mark for Review SELECT (*) 13. The DESCRIBE command returns all rows from a table. True or False? Mark for Review False (*) Section 16

14. Any Non-UID must be dependant on the entire UID. True or False? Mark for Review True (*) 15. Would it be a good idea to model age as an attribute of STUDENT? Mark for Review No - it breaks the Normalization rules (*) 16. Which statement best describes how arithmetic expressions are handled? Mark for Review Division and multiplication operations are handled before subtraction and addition operations. (*) 17. In a SELECT clause, what is the result of 2 + 3 * 2? Mark for Review 8 (*) 18. 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: Statement 2 will return a higher value than statement 1. (*) 19. In the default order of precedence, which operator would be evaluated first? Mark for Review Multiplications (*) 20. You want to create a list of all albums that have been produced by the company. The list should include the title of the album, the artist's name, and the date the album was released. The ALBUMS table includes the following columns: ALB_TITLE VARCHAR2(150) NOT NULL ALB_ARTIST VARCHAR2(150) NOT NULL ALB_DATE DATE NOT NULL SELECT * FROM albums; (*) 21. You query the database with this SQL statement: SELECT * FROM transaction WHERE product_id = 4569; Selection only (*) 22. If a SQL statement returns data from two or more tables, which SQL capability is being used? Mark for Review Joining (*) Section 17 23. 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 SELECT last_name, first_name, hire_date FROM employees WHERE hire_date BETWEEN '01-MAR-00' AND '30-AUG-00'; (*)

24. You want to create a report that displays all employees who were hired before January 1, 2000 and whose annual salaries are greater than 50000. The EMPLOYEES table contains these columns: SELECT last_name, hiredate, salary FROM employees NATURAL JOIN salary WHERE hiredate < '01-jan-00' AND salary > 50000; (*) 25. The PRODUCT table contains these columns: PRODUCT_ID NUMBER(9) DESCRIPTION VARCHAR2(20) COST NUMBER(5,2) LOCATION_ID VARCHAR2(10) SELECT product_id, cost * 1.10 FROM product WHERE cost * .10 < 10.00 AND location_id IN (4859, 9789, 9898); (*) 26. Which operator is used to combine columns of character strings to other columns? Mark for Review || (*) 27. You need to display only unique combinations of the LAST_NAME and MANAGER_ID columns in the EMPLOYEES table. Which keyword should you include in the SELECT clause? Mark for Review DISTINCT (*) 28. 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? IS NULL (*) 29. What does the DISTINCT keyword do when it is used in a SELECT clause? Mark for Review Eliminates duplicate rows in the result (*) 30. When using the LIKE condition, which symbol represents any sequence of none, one or more characters? Mark for Review % (*) 31. Which comparison condition would you use to select rows that match a character pattern? Mark for Review LIKE (*) 32. 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) SELECT DISTINCT team_id, manager_id FROM players; (*)

33. Which of the following commands will display the last name concatenated with the job ID from the employees table, separated by a comma and space, and label the resulting column "Employee and Title"? Mark for Review SELECT last_name||', '|| job_id "Employee and Title" FROM employees; (*) 34. Which SELECT statement will display both unique and non-unique combinations of the MANAGER_ID and DEPARTMENT_ID values from the EMPLOYEES table? SELECT manager_id, department_id FROM employees; (*) 35. Evaluate this SELECT statement: SELECT * FROM employees WHERE department_id IN(10, 20, 30) AND salary > 20000; DEPARTMENT_ID = 10 and SALARY = 20001 (*) 36. You need to display all the employees whose last name starts with the letters Sm . Which WHERE clause should you use? Mark for Review WHERE last_name LIKE 'Sm%' (*) Section 18 37. Which comparison condition means "Less Than or Equal To?" Mark for Review "<=" (*) 38. Which statement about the ORDER BY clause is true? Mark for Review You can use a column alias in the ORDER BY clause. (*) 39. From left to right, what is the correct order of Precedence? Mark for Review Arithmetic, Concatenation, Comparison, OR (*) 40. Which of the following is TRUE regarding the logical AND operator? Mark for Review TRUE AND FALSE return FALSE (*) 41. Which logical operator returns TRUE if either condition is true? Mark for Review OR (*) 42. 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? Mark for Review DESC (*) 43. 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; Reorder the clauses in the query. (*)

44. The EMPLOYEES table contains these columns: EMPLOYEE_ID NUMBER(9) PK LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPARTMENT_ID NUMBER(9) There is no difference in the result between the two statements. (*) 45. Evaluate this SELECT statement: SELECT last_name, first_name, department_id, manager_id FROM employees; ORDER BY manager_id, last_name, first_name (*) 46. 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? SELECT employee_id ||' - '|| last_name "Employee", hire_date ||' / '|| salary "Start Date and Salary" FROM employees WHERE hire_date <= '01-JAN-96'; (*) 47. You query the database with this SQL statement: SELECT price FROM products WHERE price IN(1, 25, 50, 250) AND (price BETWEEN 25 AND 40 OR price > 50); Which two values could the statement return? (Choose two.) 25 (*) 250 (*) 48. Evaluate this SELECT statement: SELECT last_name, first_name, email FROM employees ORDER BY email; Null email values will be displayed last in the result. (*) 49. 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; SELECT employee_id, last_name, first_name, salary 'Yearly Salary' (*) 50. Evaluate this SQL statement: SELECT product_id, product_name, price FROM products ORDER BY product_name, price;

The results are sorted alphabetically and then numerically. (*)

S-ar putea să vă placă și