Ora_PL-SQL_2

March 29, 2018 | Author: Raghavendra Kamurthi | Category: Pl/Sql, Sql, Table (Database), Data Management Software, Databases


Comments



Description

Oracle Introduction to PL/SQL1. The worker table has 11 columns. You often query the table with conditions based on four or more columns. You create an index on all columns in the table. What will result? a. b. c. d. Updates on the table will be slower. Updates on the table will be faster. Queries on the table will be faster. The size of the worker table will be increased. 2. Examine the following command: CREATE TABLE pay (employee-id Number(9) CONSTRAINT pay-pk PRIMARY KEY, 2000-pay NUMBER(8,2) manager-name VARCHAR2(25) CONSTRAINT mgr-name-nn. NOT NULL, pay-96 NUMBER(8,2)); Which two lines of this command will return an error? a. b. c. d. e. f. g. First Second Third Fourth Fifth Sixth Seventh 3. You must store currency data. All data will have two digits to the fight of the decimal point (ie, 25.xx). The numbers to the left of the decimal point will vary. Which data type is most appropriate? a. b. c. d. NUMBER NUMBER(T) LANG LANGRA 4. Examine the WORKER table below: NAME WORKER ID NAME PHONE ADDRESS POSITION NULL NOT NULL NOT NULL NOT NULL TYPE NUMBER(3) VARCHAR2(25) VARCHAR2(9) VARCHAR2(50) UPDATE There are hundreds of records in the EMPLOYEE TABLE. You need to modify the phone column to hold only number values. Which statement will modify the data type appropriately? a. b. c. ALTER TABLE worker MODIFY phone NUMBER(9) ALTER WORKER table MODIFY COLUMN phone NUMBER(9) A VARCHAR2 data type cannot be changed to a NUMBER data type for a column. d. The data type of a column cannot be modified if there is data in the column. 5. What should be done after each fetch statement in a PL/SQL block? a. b. c. d. Open the cursor. Close the cursor. Initialize the loop. Test for rows using the cursor attribute. 6. Examine this executable section of a PL/SQL block: BEGIN FOR worker_record IN pay_cursor LOOP Worker_id_table(worker_id):= Worker_record.last_name; END LOOP; CLOSE salary_cursor; END; Why does this section cause an error? a. b. c. d. The cursor needs to be open. No fetch statements were used. Terminating conditions are missing. The cursor does not need to be explicitly closed. 7. Your company will be granting workers a $150 salary increase. You need to evaluate results of the increase from the worker table prior to the actual modification. You do not want to store in the results in the current database. Which of the following is untrue? a. b. A column must be added to the worker table. An arithmetic expression must be added that invokes the salary increment in the SET section of the upgrade clause. An arithmetic expression must be added that invokes the salary increment in the SELECT clause of the SELECT statement. An arithmetic expression must be added that invokes the salary increment in the UPDATE clause of the SELECT statement. c. d. 8. What command should be used to execute a script file named QUERYCOLOR.SQL from the SQL Plus environment? a. b. c. d. START QUERYCOLOR EXECUTE QUERYCOLOR RUN QUERYCOLOR GET QUERYCOLOR 9. You need to test if the current fetch within a PL/SQL loop was successful. Which cursor attribute is needed to accomplish this task? a. b. c. d. SQL%ISOPEN SQLROWCOUNT SQL%FOUND A cursor attribute cannot be used within a PL/SQL loop. 10. You have been assigned the task of updating worker salaries. If a salary is less than 1000, it must be incremented by 10%. The SQL Plus substitution variable will be used to accept a worker number. Which PL/SQL block successfully updates salaries? a. DECLARE V_sal worker.sal%type; BEGIN SELECT sal INTO v_sal FROM worker WHERE workerno=&&p_workerno; IF ‘v_sal<1000 then’ UPDATE worker INTO sal:=sal*1.1 WHERE workerno=&p_workerno; END IF; END; b. DECLARE V_sal worker.sal%type; BEGIN SELECT sal INTO v_sal FROM worker WHERE worker=&&p_wokerno; IF ‘v_sal<1000 then sal:=sal*1. 1’ END IF; END; c. DECLARE V_sal worker.sal%type; BEGIN SELECT sal INTO v_sal FROM worker WHERE workerno=&&p_workerno; IF ‘v_sal<1000 then’ UPDATE emp sal:=sal*1.1 WHERE workerno=&p_workerno; END IF; END; d. DECLARE V_sal worker.sal%type; BEGIN SELECT sal INTO v_sal FROM worker WHERE workerno=&&p_workerno; IF ‘v_sal<1000 then’ UPDATE worker SET sal:=sal*1.1 WHERE workerno=&p_workerno; END IF; END; 11. Examine the following: SET SERVER OUTPUT ON X NUMBER; V_sal NUMBER; V_found VARCHAR2(10):= ‘TRUE’; BEGIN X:=1; V_sal:=1000; DECLARE V_found VARCHAR2(10); Y NUMBER BEGIN IF(v_sal>500) THEN v_found:= ‘YES’; END IF; DBMS_OUTPUT.PUT_LINE(‘VALUE OF v_found is’||v_found); DBMS_OUTPUT.PUT_LINE(‘VALUE OF v_sal is’||v_sal); Y:=20; END; DBMS_OUTPUT.PUT_LIN(‘VALUE OF v_found is’||v_found); DBMS_OUTPUT.PUT_LINE(‘VALUE OF Y is’||to_char(Y)); END; SET SERVER OUT PUT OFF; Why will this procedure produce an error when executed? a. b. c. d. The value of v_found cannot be YES. The variable v_found is declared in more than one location. The variable Y is declared in the inner block and referred to in the outer block. The variable v_sal is declared in the outer block and referred to in the inner block. 12. The worker table contains the following columns: First_name Last_name VARCHAR2(25) VARCHAR2(25) Evaluate these two SQL statements: SELECT CONTACT (first_name,last_name), LENGTH(CONTACT(first_name,last_name)) FROM worker WHERE UPPER(last_name)like ‘%J’ OR UPPER (last_name)like ‘%K’ OR UPPER (last_name)like ‘%L’; SELECT INITCAP(first_name)|| INITCAP(last_name), LENGTH(last_name)+LENGTH(first_name) FROM worker WHERE INTICAP(substr(last_name,1,1))In ( ‘J’, ‘K’, ‘L’); How will results differ between the two SQL statements? a. b. c. d. Different data will be retrieved from the database. The same data will be retrieved, but it will be displayed differently. The first statement will be executed; the second will not. The second statement will be executed; the first will not. 13. In the declarative section of a PL/SQL block, you create-but do not initialize-a number variable. When the block executes, what will be the initial value of the variable? the second statement will display all the object types that the user owns. the second statement will display all the object types that the user can access. Add a second condition to the WHERE condition. d. b. 15. 14. You cannot specify a column alias in an ORDER BY clause. Null values are displayed last in ascending sequences. the second statement will display the object types in the database. SELECT ROM object-type all-objects. first_name FROM worker WHERE dept_id is NULL Which of the following changes should be made to achieve the desired result? a. 0 Null The value will depend on the scale and precision of the variable.a. Data values are displayed in descending order by default. d. Query results cannot be sorted by a column that is not included in the SELECT list. d. d. b. What data dictionary view must you query to determine the number of tables you can access? a. c. b. Change the operator in the WHERE condition. The first statement will display the distinct object types owned by the users. Which of the following privileges is related to system-level security? . ALL_OBJECTS DBA_TABLES DBA_SEGMENTS USER_OBJECTS 17. Evaluate the following: SELECT last_name. Which of the following statements regarding SQL is true? a. The first statement will display the distinct object types in the database. b. the second statement will display all object types in the database. c. The block will not execute because the variable was not initialized. The first statement will display distinct object types owned by the user. How will the results of the two commands differ? a. c. d. b. Evaluate the two following commands: SELECT FROM DISTINCT object-type user-objects. c. c. 18. 16. Create an outer join. Change the column in the WHERE condition. The first statement will display the distinct object types that the user can access. You are a user of the PROD database. which has over 1200 tables. The worker table contains the following columns: LAST_NAME VARCHAR2(25) FIRST_NAME VARCHAR2(25) DEPT_ID NUMBER(9) You need to display the names of workers that are not assigned to the department. GRANT clerk TO supervisor. Jane can access the table and verify your changes. CREATE ROLE clerk. ’50 NE Oak St. c. INSERT INTO pupil. ‘20-MAR-01’. . You ask her to check your work before you issue a COMMIT command. VALUES(121.’. VALUES(121. INSERT INTO pupil.graduation) VALUES(121. The command must be issued by Mike. ALTER USER mike IDENTIFIED BY green. d. Drop any table DELETE ALTER INDEX 19. Jane can access the table. What can she do on the workers table? a. Examine the following: Name Null? Type PUPIL-ID NAME ADDRESS GRADUATION NOT NULL NOT NULL NUMBER(3) VARCHAR2(25) VARCHAR2(50) DATE Which of these statements inserts a new row into the PUPIL table? a.’. CHANGE password to green WHERE “user=mike”. ’Benson’.’. b. VALUES(121. ‘Benson’). You are updating the worker table. ALTER USER mike IDENTIFIED BY green. The command must be issued by Mike.address. but cannot see your changes or make changes to the roles you are changing. ‘20-MAR-01’). c. c. 22. LATER USER mike PASSWORD BY green. c. ’50 NE Oak St. Jane cannot access the table. ‘Benson’. ‘Benson’). She can make changes for you. d. Which of the following commands will set a password for user. d. 21. ’50 NE Oak St.name. Jane can access the table but cannot see your changes. b. 0 1 2 3 20.a. INSERT INTO pupil. GRANT janitor TO clerk. Evaluate the following: CREATE ROLE supervisor. INSERT INTO test. d. Mike forgot his password. b. d.(pupil-id. b. mike? a. / How many rows will user alex have access to? a. b. GRANT janitor to alex. Jane has been granted the same privileges as you. CREATE USER alex IDENTIFIED BY green. c. The command must be issued by the DBA. ‘20-MAR-01’). The command must be issued by the DBA. CREATE ROLE janitor. ”ORA-02291 integrity constraint (sys_c23) violated.23. Address=’50 NE Oak St’ WHERE graduation=’18-APR-2001’ 24. Within SQL Plus. d.Sum(sal)TOT-SAL. 25. Graduation=’11-MAY-2001’ WHERE pupil-id=101. you issue the following: Delete from dept_id=807 You receive an integrated constraint error indicating the child record was found. Delete the child record first. Examine the data in the GRADE DATA table: Graduation 11-May-2001 13-Jan-2001 19-Dec-2001 25-Jun-2000 Which of the following statements will produce the error…. The view WORKER-VIEW is created based on the WORKER table as follows: CREATE OF REPLACE VIEW worker-view AS SELECT deptno. Add the constraints cascade option to the command. b. What should be done to make the statement execute? a. UPDATE pupil SET pupil-id=999 Graduation=’11-MAY-2001’ WHERE stud-id=101. b. Parent key not found. Graduation=’15-AUG-200’ WHERE pupil-id=101* UPDATE pupil SET stud-id=NULL. What happens when the following command is issued? .’ UPDATE pupil SET name=’Benson’.? a. Examine the following: NAME PUPIL_ID NAME ADDRESS GRADUATION NULL NOT NULL NOT NULL TYPE NUMBER(3) VARCHAR2(25) VARCHAR2(50) DATE The GRADUATION column is a foreign key column to the table. The statement cannot be executed. c. d. c.COUNT(+)NOT-WORKER FROM worker GROUP BY deptno. Add a fourth keyword to the command. UPDATE pupil SET name=’Benson’. SELECT FROM p. that is based on the worker table.000 for department 8. END IF What would be assigned to v_new_value if v_value=250? a.player c .name participant p. ELSIF v-value>200 THEN v-new-value:=3*v-value. 26.c. You view a card.name participant p. a. 250 500 750 1000 28. b. The PARTICIPANTS table contains the following columns: ID NAME COACHID NUMBER(9) VARCHAR(2) NUMBER(9) Evaluate the following statements: SELECT FROM WHERE p. The TOT_SAL column in the WORKER table is updated to 25. Evaluate the following: IF v-value>100 THEN v-new-value:=2*v-value. b. d. c.000 for department 8.UPDATE worker-view SET lot-sal=25000 WHERE deptno=8. ELSE v-new-value:=5*v-value.c.coach-id. ELSIF v-value>300 THEN v-new-value:=4*v-value. d. b. The SAL column in the WORKER table is updated to 25.000 for employees in department 8. c.name. ANN_SAL. The TOT_SAL column in the WORKER view is updated to 25. The base table cannot be updated through this view.participant c c-id= c.2) NUMBER(9. c.name. The structure of the ANN_SAL view is: NAME WORKERNO YEARLY_SAL MONTHLY_SAL NULL NOT NULL TYPE NUMBER(4) NUMBER(9. d. SELECT * FROM ANN_SAL SELECT * FROM WORKER SELECT * FROM VIEW ANN_SAL SELECT * FROM VIEW ANN_SAL IS DON WORKER 27.2) Which statement retrieves data from the ANN_SAL view? a. b. d. c. A cursor for each active set. d. c. DECLARE TYPE worker-table is TABLE of worker%ROWTYPE INDEX BY WHOLE NUMBER: worker-table worker-table-type. The first statement will not execute. c. 32. 30. b. the second statement is not. DECLARE TYPE worker-table is TABLE of worker%ROWTYPE INDEX BY BINARY INTEGER. A loop cursor. the second statement will. d. the second statement will not execute. . You do not explicitly open. END. or close a cursor within a cursor for loop. 31. A multiple selection cursor. 29. c.id. Which of the following is true when writing a cursor for loop? a. The results will be the same. but will be displayed differently. d. You must explicitly close the cursor prior to the end of the program. The structure of the HOUSE table is as follows: Name HOUSE NO DNAME LOC Null? Not NULL Type Number(25) VARCHAR2(14) VARCHAR2(13) Examine the following: DECLARE house-rec house%ROWTYPE: BEGIN SELECT* INTO house-rec FROM house.coach-id=p. The first statement will execute. BEGIN TYPE worker-table is TABLE of worker%ROWTYPE worker-table worker-table-type. Which type of cursor should be created when you want to create a cursor that can be used several times in a block. DECLARE worker-table is TABLE OF worker%ROWTYPE b. You must explicitly open the cursor prior to the cursor for loop. WHERE houseno=10. The first statement is a self join. selecting a different active set each time it is opened? a. b. A cursor that uses parameters. How will the results of the two statements differ? a. fetch. worker-table worker-table-type. How would you declare a PL/SQL table of records to hold the rows selected from the WORKER table? a.WHERE c. You must explicitly fetch the rows within a cursor for loop. 33. b. c. Implicit cursors can be declared using the cursor type in the declaration section. Which of the following statements about implicit cursors is true? a. wname.PUT_LINE(house-rec-loc). Select statement returns more than one row. hiredate. wname. They are declared implicitly only for DML statements. Select statement contains a group by clause. NUMBER(2). wname. c.30). DECLARE v-hiredate DATE:=SYSDATE: BEGIN INSERT INTO worker(workernp. d. b. Select statement does not have a WHERE clause. b. divisionno) DECLARE v-hiredate DATE:=SYSDATE: BEGIN INSERT INTO worker(workernp.nextval. c.OUTPUT.PUT_LINE(house-rec): DBMS. 0 1 True Null 35. Which two conditions in a PL/SQL block cause an exception error to occur? a. Select statement does not return a row. You can’t display a single file in the record because they are not specially identified in the declarative section. END. b. hiredate. What will be the value of v_result if no rows are deleted? a. Which of the following successfully uses the INSERT command? a. The are declared implicitly for all DML and SELECT statements. divisionno) VALUES(workerno-sequence.nextval. c. SQL/ROWCOUNT. ‘and name’. b. hiredate) VALUES(workerno-sequence. d. d. ‘and name’.OUTPUT. 34. v_hiredate and divisionno) DECLARE v-hiredate DATE:=SYSDATE: BEGIN INSERT INTO worker(workernp. worker division-id IN(10.PUT_LINE(house-rec(1). Implicit cursors must be closed before the end of PL/SQL programs. Evaluate the following: DECLARE v-result BEGIN DELETE FROM WHERE v-result:= COMMIT. v_hiredate and divisionno) . d.loc). 36. DBMS-OUTPUT. c. You must create a program to insert records into the worker table.20.Which PL/SQL statement displays the location of a selected department? a. DBMS. v_hiredate and divisionno) Job=Clerk END: 37.hire_date))>60 GROUP BY by section_no ORDER BY AVG(MONTHS_BETWEEN(SYSDATE. (I). d. ELSE INSERT INTO test(result) VALUES END IF. 39. e.hire-data)) FROM worker WHERE AVG(MONTHS_BETWEEN(SYSDATE. All users are given object privileges to the table. How many values will be inserted into the test table? a. END LOOP. You query a database with the following command: SELECT section_no. ROLL BACK. GROUPBY 40. The need to qualify the object name with its schema is eliminated for all users. HAVING. d. GROUPBY WHERE. wname.worker. Why does the command cause an error? a. WHERE WHERE. c. b. You issue the following command: CREATE public synonym WORKER for ed. 0 4 6 8 12 38. The object can be accessed by all users. c.hire_date)). HAVING. Evaluate the following: BEGIN FOR i IN 1. WHERE. HAVING GROUPBY. b. The need to qualify the object name with its schema is eliminated only for the commanding issuer. In which order does an Oracle Server evaluate clauses? a.10 LOOP IF I=4 OR I=6 THEN null.. A SELECT clause cannot contain a group function. COMMIT.AVG(MONTHS_BETWEEN(SYSDATE.d. END: DECLARE v-hiredate DATE:=SYSDATE: BEGIN INSERT INTO worker(wordernp. HAVING. b. GROUPBY. d. What is the result of the command? a. END. . c. DBMS_OUTPUT. The first statement will only display one row of results. b.sql RUN welcome. Examine the following: SET SERVER OUTPUT ON DECLARE v_char_val varchar2(100). A group function cannot contain a single row function. the second statement will display a result for each product. Which of the following statements will execute the code in the script file? a. 41. The path table contains the following columns: ID NUMBER(7) PK COST NUMBER(7.2) FROM part GROUPBY product_id. The first statement will display a result for each part. round(sum(cost). ROUND(min(cost). d. One of the statements will cause an error.sql EXECUTE welcome. In which section of a PL/SQL block is a user-defined exception written? a. How will the results of the two statements differ? a. but displayed differently.2). d. 42. d. An ORDER BY clause cannot contain a group function.b. ROUND(max(cost). b. SELECT product_id. c. A WHERE clause cannot be used to restrict groups.2) FROM part.2). b. END SET SERVER OUTPUT OFF This code is stored in a script file named welcome. d. The results will be the same. welcome. BEGIN v_char_val:= ‘Welcome Home’. Heading Executable Declarative Exception handling 43.sql START welcome.PUT_LINE(v_char_val).2). c.sql .sql.2). the second statement can display more than one row of results. ROUND(AVG(cost). ROUND(AVG(cost). c. c.2)’ ROUND(min(cost). ROUND(sum(cost).2) PRODUCT_ID NUMBER(7) Evaluate the following SQL statements: SELECT ROUND(max(cost).2). The results provide more information than management requested. SELECT wname. A variable in an inner block may have the same name as a variable in an outer block only if the data types are different.44. b. A function needs to be included in the SELECT statement to achieve the desired result. d.w_sal FROM worker WHERE workno=106. SAVE LOG.10 FROM merchandise. Which of the following SELECT statements should be used? . b. The merchandise table contains the following columns: CODE COST SALE_PRICE NUMBER(9) NUMBER(7. A variable defined in the inner block is visible in the outer block.LST PRINT LOG.LIN(“Nothing found”). b. You have been instructed to create a report that shows different jobs in each division within your company. c. Only the required results are displayed. 48. p_max OUT NUMBER) IS BEGIN If n1>n2 then p_max:=n1. c. 45.cost * 1.LST SPOOL LOG. d. A variable defined in the outer block is visible in the inner block.sal INTO w_ename. What conclusion can be drawn from the results? a.2) NUMBER(7. BEGIN Worker_rec worker%ROWtype END.2) PK Your supervisor asks you to calculate net revenue per unit for each product if the cost of each product is increased 10% and the sale price of each product is increased 25%. What command will send the output of an SQL* Plus session to a text file named LOG.LST SEND LOG. Variable names must be unique between blocks. b. Which of the following statements is valid within the executable section of a PL/SQL block? a. c. WHEN NO_DATA FOUND THEN DBMS_OUTPUT PUT. Else p_max=n2. END.25 . 46. You issue the following: SELECT code. The order of the statement must be changed to get the requested results. sale_price * 1. d. Procedure cal_max(n1 NUMBER n2 NUMBER.LST? a.LST 47. d. No duplicate roles can be displayed. c. Which of the following statements regarding nesting blocks is true? a. job 49. d. c. b. sal. job FROM worker. c. SELECT distinct divisionno. hire_date)) FROM worker WHERE AVG (MONTHS_BETWEEN (SYSDATE. A WHERE clause cannot be used to restrict groups. An ORDER BY clause cannot contain a group function. SELECT no duplicate divisionno. All employees have a manager. A null value is returned from the subquery.a. . and all other employees report to the four managers. 51. b. c. the values returned from the subquery are compared as a group to the values in the outer query. A non-pair wise comparison produces a cross product. and average salaries for all workers who earn more than the average salary in their department? a. 52. Mrs. salary. A group function cannot contain a single row function. The above statement returns no rows. job FROM worker. None of the employees have a manager. b. sal.wname FROM work worker WHERE worker. d. AVG (MONTHS_BETWEEN (SYSDATE. A pair wise comparison produces a cross product. Four managers report to her. hire_date)) > 60 GROUP BY dept_no ORDER BY AVG (MONTHS_BETWEEN (SYSDATE. Jensen is president of her company. divsionno. c. workno not in SELECT manager. Which of the following SELECT statements displays worker names. Examine the following: SELECT worker. A SELECT clause cannot contain a group function. SELECT wname. d. hire_date) ) Where does the statement cause an error? a. In a non-pair wise query. SELECT divisionno. the values returned from the subquery are compared individually to the value in the outer query. AVG(sal) FROM workers GROUPBY wname. Why? a. division numbers. An operator is not allowed in subqueries. Which of the following statements regarding column subqueries is true? a. job FROM worker. d. You query a database with the following command: SELECT dept_no.mgr FROM work manager. CREATE report DISPLAY divisionno. b. In a pair wise query. divisionno (other multiple choice answers not available) 50. The results will be the same. Use the ACCEPT account. Close the cursor. The worker table contains the following columns: ID_NUMBER(9) LAST_NAME DEPT_ID PK VARCHAR2(25) NN NUMBER(9) Evaluate the following: DEFINEid_3=93011 SELECT FROM worker WHEREid = (% id_3) Which change should be made to the script so that it will execute? a. b. Allows you to add columns to a table. Evaluate the following: SELECT w.25* w. b. Produces a group of results from each row. b. c.bonus)) (w.15* w. c. c.15* w. Produces one result from many rows per group. projection ______.id. Which of the following is not an SQL Plus command? a. sales WHEREw. 56. (. 58. Allows you to join tables together. The worker table contains the following columns: . c. When selecting data. Results will be lower. 55. What would be the result of removing all parentheses from the calculation? a.53. d. d. d. Produces one result from each row of a table.commision_pct)) FROM worker w . DESCRIBE UPDATE CHANGE ACCEPT 57.sale_amount * (. a. Allows you to choose columns. The statement will not execute. Produces many results from many rows per group. Results will be higher. c. b. Remove the ampersand. No change is needed. A group function ______. 54. b.worker_id. a.salary) + (. d. d.id = s. Allows you to choose rows. last_name. SELECT FROM b. 3 2 1 The statement generates an error. Exclude employees with zero commission. Evaluate the following statement: SELECT FROM WHERE id.ID LAST_NAME FIRST_NAME COMMISSION NUMBER(9) VARCHAR2(25) VARCHAR2(25) NUMBER(7. SELECT FROM ORDER BY hire_date worker.5.5 worker commission <>0. 59. c. and are given the following guidelines:    Display commission multiplied by 1. division_table. 60. first_name. hire_date worker hire_date DESC.loc := := ‘Boston’.2) You must display commission calculations for employees. Which of the following statements should be used? a. commission*1. b. How many guidelines are met by the statement? a. Display a zero for employees with null commission value.13 division_table[13]. hire_date worker hire_date. worker worker hire_date. What SQL statement must be used to display each worker hire date from earliest to last? a. . ‘Boston’. SELECT FROM ORDER BY d. You need to assign LOC file in record 13 of value ‘Boston’. The division table is structured as follows: Name DIVISIONNO DNAME LOC Null NOT NULL Type NUMBER(2) VARCHAR2(14) VARCHAR2(13) Examine the following declaration: DECLARE TYPE division_table_type IS TABLE OF division &ROWTYPE INDEX BY BINARYINTEGER division_table division_table_type.loc. Click EXHIBIT and examine the trace instance chart for the worker table (exhibit not available). SELECT FROM ORDER BY c. b. d. d. b. DELETE FROM color. Declarative. What command should you issue. division_table(13). Execution. c. 7. 65. A variable name must be unique between blocks. c. x_date DATE . d. END LOOP. ______. Which of the following statements accomplishes this? a. TRUNCATE TABLE color. 62. 8. ‘Boston’.loc division_table_type(13). 6. 64. UPDATE worker SET values job = ‘Administrative Assistant’ WHERE UPPER(job) = ‘Secretary’. DROP TABLE color. 5. i := i + 1. You need to change the job title “Secretary” to “Administrative Assistant” for all secretaries. b. c.c. END You encounter unexpected results while executing the above code. 3. A variable defined in the outer block is visible in the inner blocks. 2. if you must be able to undo the operation? a. Examine the following: 1. 11. How can you trace the values of counter variable 1 and date variable x_date in an SQL* PLUS environment? . 61. 10. 4. In which section of a PL/SQL block is a user-defined exception raised? a. d. b. d. 63. DECLARE i NUMBER := 0. BEGIN i := i + 1. d. a. Heading. EXIT WHEN i = 5. c. In nesting blocks. 9.loc := := ‘Boston’. A variable defined in the inner block is visible in the outer blocks. A variable in an inner block may have the same name as a variable in an outer block if the data types are different. UPDATE worker UPDATE worker Job := ‘Administrative Assistant’ WHERE UPPER(job) = ‘Secretary’ UPDATE worker SET job = ‘Administrative Assistant’ WHERE UPPER(job) = ‘Secretary’. You must remove all data from the color table while leaving the table definition intact. This cannot be done. b. Exception handling. LOOP i := v_date + 5. In operators. c.This code displays salaries if larger than 10. SELECT wname.000. Last name and first name of all workers except those working in divisions 3 and 5.DEBUG_VAR (I. sal INTO v_name.GT. d. Set the SQL* PLUS session variable DEBUGGER=TRUE. IF (v_sal. v_name NUMBER.10000) THEN DBMS_OUTPUT. 68.PUT_LINE (I. Last name and first name of all workers with the same salary as workers in divisions 3 and 5. v_sal NUMBER(8.PUT_LINE(‘Salary is ‘||’ v_sal || ‘for worker’ || v_name). Between lines 8-9 66. Insert the statement: DBMS_OUTPUT .PUT_LINE (I ||’’|| TO_CHAR(v_date)).wname%TYPE. 67. Last name and first name of workers in division numbers 3 and 5. v_num NUMBER. Between lines 8-9 c.a. Examine the following: SET SERVEROUTPUT ON DECLARE v_name worker.GT. b. first_name worker SALARY_IN (SELECT salary) FROM worker WHERE division_no=3 OR division_no=5). Last name and first name of workers whose salaries fall in the range of salaries in divisions 3 and 5. Insert the statement: DBMS_OUTPUT . Insert the statement: DBMS_OUTPUT .2). b.10000) THEN --. Between lines 8-9 d. END IF. END SET SERVER OUTPUT OF This statement produces a compilation error when which PL/SQL block is executed? a. Which values are displayed? a. Which operator is not appropriate in the joined condition of a non-equijoin select statement? a.000. b. v_num NUMBER. Like operators . d. b. BEGIN --. c.This code displays salaries if larger than 10. x_date). You query the worker database with this command: SELECT FROM WHERE last_name. x_date). IF(v_sal. v_sal FROM worker WHERE workerno=101. DELETE FROM invoice d. b. b. 5. All users are given object privileges to the table. Examine the structure of the PUPILS table: Name PUPIL ID NAME ADDRESS GRADUATION Null NOT NULL NOT NULL Type NUMBER(3) VARCHAR2(25) VARCHAR2(50) DATE What statement will add a new column after the NAME column to hold phone numbers? a. Which task has been accomplished? a. d. but will need the table structure in the future. 70. c. 5. The table structure and its deleted data cannot be rolled back and restored once the DROP TABLE command is executed. c. The need to qualify object names with the schema is eliminated only for you. 69. DROP TABLE invoice b. The need to qualify object names with the schema is eliminated for all users. 5. 71. ALTER TABLE pupils ADD COLUMN3(phone varchar2(9)) ALTER TABLE pupils ADD COLUMN3(phone varchar2(9)AS COLUMN3. 5. If a DROP TABLE command is executed on a table. worker. TRNCATE TABLE invoice KEEP STRUCTURE. You issue the following command: CREATE PUBLIC SYNONYM work FOR ed. LONG NUMBER NUMBER(p. d. TRUNCATE TABLE invoice c. b. The DROP TABLE command can be executed on a table on which there are pending transactions.1236. What single command should be issued? a. d. ALTER TABLE pupils . The structure of the table remains in the database and the indexes are deleted. ______.s) INTEGER 72. Any appending transactions are rolled back.c. You must permanently remove all data from the INVOICE table. The object is now accessible to all users. b.1. c. d. Which data type should be used for calculating statistical probabilities with varying decimal placements (ie. a. 73. c. Greater than and equal to operators.001)? a. Equal operators. b. 76. c.salary FROM worker. e. SELECT last-name. c. Position cannot be specified when a new column is added.‘10-dec-99’) /6 (‘09-dec-99’ . division-recdivision-record-type.ADD COLUMN3(phone varchar2/9)POSITION 3.12 ‘09-dec-99’ + (12/24) ‘09-dec-99’ . SELECT last-name. 77. How can you retrieve an entire row of the division table using the division-rec variable? a. ‘09-dec-99’ + 6 ‘09-dec-99’ . f. Which three SQL arithmetic expressions will return a date? a. This cannot be done. b. ALTER TABLE customer ADD (id-number CONSTRAINT cus-id-pk PRIMARY KEY).v-salary WHERE id=5. 74. c.salary FROM worker. WHERE id=5. name VARCHAR(20)). INTO v-last-name.salary INTO v-last-name. ALTER TABLE customer MODIFY(id-number CONSTRAINT cus-id-pk PRIMARY KEY).‘10-dec-99’) /12 75. Which statement should be used to add and immediately enable a primary key constraint to the customer table using the id-number column? a. SELECT last-name.‘10-dec-99’ (‘09-dec-99’ .salary FROM worker. The structure of the division table is as follows: Name DIVISION NO DNAME LOC Null? Not NULL Type Number(20) VARCHAR2(12) VARCHAR2(13) Examine the following declaration: DECLARE TYPE division-record-type is RECORD (dno NUMBER.v-salary WHERE id=5. d. d. SELECT* INTO division-rec FROM division . SELECT last-name. d. ALTER TABLE customer ADD CONSTRAINT cus-id-pk PRIMARY key(id-number). d. Which of the following SELECT statements will query the worker table and retrieve the last name and salary of the employee whose idea is 5? a. b. divisionno FROM work.wname. Using a cursor FOR loop. b.division-rec FROM division WHERE division no=10. CLOSE worker-cursor. BEGIN FOR work-rec IN work-cursor LOOP INSERT INTO temp-work(name. SELECT* INTO division-rec. DECLARE CURSOR work-cursor 1S SELECT wname.divisionno). END LOOP END.worker-rec divisionno). work-re. worker-rec worker-cursor %ROWTYPE BEGIN OPEN worker-cursor LOOP FETCH worker cursor INTO worker-rec EXIT WHEN worker-cursor NOT FOUND.name. which PL/SQL block is equivalent to the above code? a.loc INTO division-rec FROM division WHERE division no=10. work-re. END.divsisionno . INSERT INTO temp-worker(name’dno) VALUES(worker-rec. c.divisionno). DECLARE CURSOR work-cursor 1S SELECT wname.division-rec.dname. You can’t retrieve an entire row using the division-rec variable declared in the code.divisionno FROM work.wname. BEGIN FOR work-rec IN work-cursor LOOP OPEN work-cursor. c. INSERT INTO temp-work(name.dno) VALUES (work-rec. DECLARE CURSOR work-cursor 1S SELECT wname. SELECT divisionno. 78.b. WHERE division no=10. d. END LOOP.wname. CURSOR worker-cursor IS SELECT wname. Examine the following: DECLARE. END LOOP END.dno) VALUES (work-rec.divisionno FROM worker.dno. b. He can create any table or procedure in his schemas only. Grant Joshua the CREATE SESSION privilege. work-re. d. c. The INTO clause is missing from the SELECT statement. END. 82. A DBA has added privileges to Randall’s account to create tables and procedures on a database. INSERT INTO temp-work(name. He can create a table in any schema of the database but can drop tables from and create procedures only within his own schemas.d. d. Database access is granted by default. Which data dictionary view contains the definition of a view? . 83. END LOOP CLOSE work-cursor.wname. Examine the following: DECLARE CURSOR query_cursor (v_salary) IS SELECT LAST_NAME. Use the ALTER USER command to assign Joshua a default profile. He can drop any table from his schema only. b. b. When a delete statement in a PL/SQL block deletes more than one row. FROM work.divisionno). 81. When a select statement in a PL/SQL block is more than one row. When an update statement in a PL/SQL block has to modify more than one row. d. drop tables. A WHERE clause is not allowed in a cursor statement. DIVISION_NO FROM WORKER WHERE SALARY>V_SALARY. The parameter mode was not defined. A scalar type was not specified for the parameter. The above code cannot be simulated with a LOOP. b. c. When any DML or select statement is used in a PL/SQL block. and create procedures in any schema of the database. c. An explicit cursor must be used ______. a. c. Use the ALTER USER command to assign default table space to Joshua. you create a user with the following command: CREATE USER Joshua IDENTIFIED BY jyd205 What must you do to allow Joshua database access? a. Which of the following can Randall perform? a. Why does this statement cause an error? a. d. SALARY. He can create a table or procedure in any schema of a database and can also drop tables in any schema of the database.dno) VALUES (work-rec. BEGIN FOR work-rec IN work-cursor LOOP OPEN work-cursor. He can create tables. 80. Using SQL Plus. 79. b. The need to create a new view or table is eliminated by placing a sub query in the FROM clause. Which of the following statements regarding the use of a sub query in the FROM clause is true? a. b. then create a new view with a WHERE clause. b.a. UU ID_NUMBER NUM 10 last_name first_name NN NN VARCHAR2 25 VARCHAR2 25 birth_date physician_id PHYSICIAN DATE NUM 10 . c. d. c. A sub query cannot be used in the FROM clause. UU ID_NUMBER NUM 10 last_name first_name NN NN VARCHAR2 25 VARCHAR2 25 birth_date physician_id PHYSICIAN DATE NUM 10 You create the patient_vu view based on the id number and last name columns from the patient table. The need to grant SELECT privileges is eliminated by placing a sub query in the FROM clause. 87. Replace the view. Click on the EXHIBIT button and examine the worker table (exhibit not available). 86. adding a WHERE clause. c. Drop the patient_vu. Use the ALTER command to add a WHERE clause to verify the date. c. MY_VIEWS USER_VIEWS SYSTEM_VIEWS USER_TAB_VIEWS 84. You create the worker table using the following command: CREATE VIEW division-salary-vu AS SELECT division-no. How should you modify the view to contain only patients born in 1998? a. d. For which employee can you update the dept no column using this view? a. d. Examine the following chart: Column name Key type Nulls/Unique FK table FK column Data type Length Id_number PK NN. Drop the patient_vu. d. Click on the exhibit button and examine the table instance chart of the patient table Column name Key type Nulls/Unique FK table FK column Data type Length Id_number PK NN.last-name FROM worker WHERE salary>45000 WITH CHECK OPTION.salary. Placing a sub query in the FROM clause defines a data source for future SELECT statements. b. Brown South Chizza None 85. then create a new view with a HAVING clause. Updates on the table will be slower. last_name.&first_name. SELECT TO_CHAR (hire_date. 89. &last_name.’fmDD “of” MONTH YYYYY’)DATE HIRED FROM worker.2 DEPT_NO FK DEPARMENT DEPT_NO NUM DATE 3 You must display hire_date values in the following format: 16 of January 20001 Which SELECT statement must be used? a. INSERT INTO patient(id_number. b. Birth_date) VALUES(patient_id_seq.NEXTVALUE. Which script should be used? a. The size of the fruit table will increase. d. SELECT hire_date(fmDD “of”MONTH YYYY’) “Date Hired” FROM worker. The fruit table has ten columns. You must write a script to insert a row into the patient table and use the sequence you created. Examine the worker table: WORKER Column name HIRE_DATE Key type Nulls/unique FK table ID_NO NAME PK NN. Which of the following will occur? a. & birth_date) / d. first_name. & birth_date) / 88. All queries will be faster. c.’DDspth of MONTH YYYY’) “Date Hired” FROM worker. birth_date) / c. first_name. SELECT TO_CHAR(hire_date. INSERT INTO patient(id_number. d. you create an index on all columns in the table. Inserts will be faster. SELECT hire_date(‘DD “of”MONTH YYYY’) “Date Hired” FROM worker. This cannot be done. last_name. c. UU NN SALARY HIRE_DATE DEPT_NO FK DEPARMENT . first_name. &last_name. last_name. b. INSERT INTO patient(id_number.&first_name. first_name. Birth_date) VALUES(patient_id_seq.You create the patient_id_seq sequence to be used with the patient table’s primary key column. b. Birth_date) VALUES(patient_id_seq. The sequence begins at 1000 and has a maximum value of 99999999 and increments by 1. UU NAME NUM 9 VARCHAR2 25 SALARY NN NUM 8. last_name.NEXTVAL. Because you query the table with conditions based on four or more columns. Examine the worker table: WORKER Column name Key type Nulls/unique FK table FK column Data type Length ID_NO PK NN. 90. d. VALUES(i). END LOOP. d. ELSIF i=3 THEN COMMIT. Which of the following scripts could be used to query the data dictionary to view only the names of the primary key constraints using a substitution parameter for the table name? a. FROM worker. ACCEPT TABLE PROMPT(‘table to view primary key constraint:’) SELECT constraint_name FROM user_constraint WHERE table_name=upper(‘&table’) AND constraint_type= ‘P’. FROM worker GROUP BY hire_date. FROM worker ORDER BY hire_date. b. ACCEPT TABLE PROMPT(‘table to view primary key constraint:’) SELECT constraint_name FROM user_constraint WHERE table_name=upper(‘&table’) AND constraint_type= ‘PRIMARY’. ELSIF i=5 THEN ROLLBACK. ELSE INSERT INTO calculate(results).2 DEPT_NO NUM 3 DATE Which SQL statement will display employee hire date from earliest to latest? a. b. 0 1 2 3 4 5 92. e. b. c. f. c. END IF. SELECT hire_date. ACCEPT TABLE PROMPT(‘table to view primary key constraint:’) SELECT constraint_name . 5 LOOP IF i=1 THEN NULL. SELECT hire_date. ACCEPT TABLE PROMPT(‘table to view primary key constraint:’) SELECT constraint_name. END. Evaluate the following PL/SQL block: BEGIN FROM I IN 1 .constraint_type FROM user_constraint WHERE table_name=upper(‘&table’). SELECT hire_date. How many values will be permanently inserted into the calculate table? a. FROM worker ORDER BY hire_date DESC. SELECT hire_date. d.FK column Data type Length NUM 9 VARCHAR2 25 NUM 8. . COMMIT. 91. c. You attempt to create the salary table with this command: CREATE TABLE TENURE.prodid. Product ID.2)). 95. c. ALTER TABLE patient ADD (id_number CONSTRAINT pat_id_pk PRIMARY KEY). (worker_id NUMBER(9) CONSTRAINT tenure_pk PRIMARY KEY. 1995_salary NUMBER(8. $ salary_96 NUMBER(8. ALTER TABLE patient ADD CONSTRAINT pat_id_pk PRIMARY KEY(id_number). 93. e. b. This cannot be done.FROM user_cons_columns WHERE table_name=upper(‘&table’) AND constraint_type= ‘P’. Match the Constraint Name to its appropriate Definition: Constraint Name CHECK NOT NULL UNIQUE PRIMARY KEY FOREIGN KEY Definition The column must contain a value in each row. 1 2 3 4 5 6 7 96. What statement would be used to add a primary key constraint to the patient table using the id_number column. 94. Defines a condition that each row must satisfy. b. Each value must be different in a column. d. ANSWER : The correct matching is CHECK: NOT NULL: UNIQUE: PRIMARY KEY: FOREIGN KEY: Defines a condition that each row must satisfy. and quantity of items in the merchandise table that matches both the Product ID and quantity of an item. g. Which SELECT statement displays the Order ID. The column must contain a value in each row. NUMBER manager_name VARCHAR2(25) CONSTRAINT mgr_name_nn NOT NULL. SELECT ordeid. Each value must be different in a column. order(20)? a. ALTER TABLE patient MODIFY(id_number CONSTRAINT pat_id_pk PRIMARY KEY). immediately enabling the constraint? a. The value must be unique and present.2). d. c. f.qty FROM merchandise . Establishes a relationship between columns. The value must be unique and present. Which two lines of the statement will return errors? a. Establishes a relationship between columns. c. Why does this statement cause an error? a.qty) = (SELECT prodid. SELECT w.qty FROM merchandise WHERE ordid=20).qty) IN (SELECT prodid.qty FROM item WHERE ordid=20).wname FROM work w WHERE w.wname FROM work w WHERE w. SELECT w. SELECT ordeid.wname FROM work w WHERE w. ANDordid<>20. A WHERE clause cannot be used in a cursor statement.workno NOT IN (select m. b. SELECT ordeid. .qty FROM merchandise WHERE (prodid. The INTO clause is missing.qty FROM merchandise WHERE (prodid. SELECT w.mgr FROM work w WHER m.prodid. d.workno IN (select m. SELECT w. 97. Which of the following SELECT statements displays all workers without a subordinate? a.prodid.qty) IN (SELECT prodid.workno NOT IN (select m.mgr FROM work m).qty) IN (SELECT ordid.wname FROM work w WHERE w.mgr FROM work m). b.qty FROM merchandise WHERE (prodid. Examine the following cursor statement: DECLARE CURSOR query_cursor(v_salary)IS SELECT last_name. AND ordid<>20.qty FROM merchandise WHERE ordid=20).mgr IS NOT NULL). c. SELECT ordeid. AND ordid<>20. d.prodid. 98.salary_divison_no FROM worker WHERE SALARY>v_salary.qty FROM merchandise WHERE ordid=20) b.mgr IS NOT NULL.prodid.WHER (prodid. b.2) NUMBER(7.e.name.printer WHERE pt.lowsal and t.e.salary.tax grade FROM emp e.salary.name FROM part pt. What will occur? a. d. 100.tax grade FROM emp e.product.2) NUMBER(2) TYPE NUMBER NUMBER NUMBER You must create a report that displays employee details along with the tax category of each employee.salary.tax grade FROM emp e.tax grade FROM emp e.product_id(+)=pr.salary between t.tax t WHERE e.salary>=t.9) NUMBER(4) DATE NUMBER(7.c. c.salary in t.name.highsal.tax t WHERE e.lowsal and t.salary<=t.tax t WHERE e.e. The parameter mode is not defined in the statement.e. A list of products is displayed for parts that have products assigned.e. Which of the following SELECT statements will perform the necessary comparisons? a.e.highsal. b.name. SELECT e. The tax category is determined by comparing the salary of the employee from the emp table to the upper and lower salary values in the tax table.e.e.tax t WHERE e.lowsal and <= t.highsal.lowsal and >= t. 99.Examine the structure of the product and part tables: PRODUCT Id PK Name PART Id PK name Product_id cost You issue the following statement: SELECT pt. An error will be generated.name. d. SELECT e.highsal. A list of product names will be displayed.id.salary. SELECT e. SELECT e.* . A scalar data type was not specified by the parameter. c. Examine the structure of the EMP table: EMP TABLE NAME EMP NUMBER VARCHAR2 JOB MGR HIREDATE SALARY COMM DEPT NO TAX TABLE NAME TAX GRADE LOWSAL HIGHSAL NULL? NOT NULL VARCHAR2 NOT NULL NULL? TYPE NUMBER(4) NUMBER(10) NUMBER(2. Many results from many rows per group. Which of the following statements will accomplish the task? a. not reuse numbers. CREATE SEQUENCE patient_id_seq START WITH 1000 MAXVALUE 9999999 NO CYCLE: CREATE SEQUENCE patient_id_seq START WITH 1000 MAXVALUE 9999999 STEP BY 1. d. 102. have a maximum value of 9999999. c. Increase the chance of full table scans. 101. A group of results from one row. b. One result from many rows per group. One result from each row in a table. U ID_NUMBER NUM 10 last_name first_name NN NN VARCHAR2 25 VARCHAR2 25 birth_date Physician_id PHYSICIAN DATE NUM 10 You must create the patient_id_seq sequence to be used with the patient table’s primary key column. b. c. d.Examine the patient table: Column name Key type Nulls/Unique FK table FK column Data type Length id_number PK NN. and increment in quantities of 1. CREATE SEQUENCE patient_id_seq ON PATIENT(patient_id) MINVALUE 1000 MAXVALUE 9999999 INCREMENT BY 1 NO CYCLE. a. c.Examine the structure of the division and worker tables below: DIVISION id PK Name WORKER id PK Last_name First_name Divion_id Evaluate the following statement: CRATE INDEX ON worker_division_id_idx worker(divison_id).A group function produces ______. . A list of all products is displayed for products with parts. Store and index the worker table. b. Reduce disk I/O for SELECT statements. What will be the result of the statement? a. Reduce disk I/O for INSERT statements. The sequence will begin with 1000.d. 103. the number of workers and total salary as a percentage of all divisions. User Ed.divisionno “division”. d. SELECT “division”. per division. SELECT divsionno “division”.num_work/COUNT(*))* 100 “%workers”. PCT(sal) “%salary” FROM scott.work GROUP BY divisionno)b.COUNT(*)num_work. Because of the command.SUM(SAL)sal_sum FROM scott.total_sal * 100.SUM(SAL)sal_sum FROM scott. the need to qualify an object name with its schema has been eliminated for ______. 105. FROM (SELECT divisionno. SELECT a. b. d.work GROUP BY divisionno. b. (COUNT(*)/count(workno))* 100 “%workers”. The worker table column corresponding to the region table contains null values for rows that need to be displayed. This cannot be done.employee. ROUND(a.39 Which of the following SELECT statements will produce the above report? a. (SUM(sal)count(*))* 100 “%salary” FROM scott. (a.47 32. a. d. Examine the results of the report: DIVISION 10 20 30 %WORKERS 21.num_work/b. Users with access.You must create a report that gives. The worker table has two columns that correspond. 106.In which situation would an outer query be used? a.15 37. a. c.71 42.total_count * 100. SELECT divisionno “division”. c.86 %SALARY 30.COUNT(*)num_work.2)“%workers” ROUND(a.d. b. The worker and region tables have corresponding columns. 104.2) “%salary% FROM (SELECT divisionno.divisionno. PCT(workno) “%workers”.You issue the following command: CREATE SYNONYM work FOR ed.sal_sum/b.work GROUP BY divisiono. All users. The worker and region tables have no corresponding columns. Only yourself. (a. c. .sal_sum/COUNT(*))*100 “%salary”.4 35.work GROUP BY divisionno)a. b.The worker table has three columns: LAST_NAME FIRST_NAME SALARY VARCHAR2(23) VARCHAR2(23) NUMBER(7. What change should be made to the statement? a. A single row query has been used with a multiple-row comparison operator. Describe work DESCRIBE view work_view SELECT TEXT FROM user_views WHERE view_name= ‘WORK_VIEW’. copy. The statement requires no modification. d. 109. Sub queries cannot be used with the WHERE clause.You attempt to query the worker database with the following command: SELECT name.salary FROM worker Where salary= (SELECT salary FROM worker WHERE last_name= ‘Johnson’ OR dept_no=43) The statement will cause an error because ______. Use a sub query in the WHERE clause to compare the salary value. c.107.2) Your manager requests that you write a statement to display all workers earning more than the average salary of all workers. c. SELECT view_text FROM my_views WHERE view_name= ‘WORK_VIEW’’ 110. Move the function to the SELECT clause and add a GROUP BY clause.Which statement will provide the view definition of the work_view that is created based on the worker table? a. a.Examine the structure of the movie title. Change the function in the WHERE clause. d. and check_out tables: MOVIE IdPK Title Director COPY IdPK Title id PK Available CHECK_OUT IdPK Copy_id Title_id Check_out_date Expected_return_date Customer-id . 108. b. c. Evaluate the following SQL statement: SELECT FROM WHERE last_name worker salary > AVG(salary). A multiple-row sub query has been used with a single row comparison operator. b. d. Logical apparatus are not allowed in the WHERE clause. What is the result of the statement? a. Include the availability of each movie. b.director. c. . and have the following parameters:    Include the title of each movie.available FROM movie_title b. A subset of employees will be given a 270 increase in bonus. 111.title_id ORDER BY b. d. Evaluate the following statement: CREATE VIEW movies_available AS SELECT b. Which data dictionary view would you query to display the column? The privileges were granted on the schema that owns the worker table. All employees will be given a bonus of 270. b. Bonus values do not exceed 500. Which of the parameters are met? a. Order the results by director. All employees will be given a 270 increase in bonus.You need to create the MOVIES_AVAILABE view. All Two One A syntax error results. There are three divisions within your company and each division has at least one worker bonus program and at least one worker. Evaluate the following block: DECLARE V_bonus worker. COMMIT.c. not all employees receive bonuses. b. d. ALL_TABLES TABLE_PRIVILEGES ALL_COL_PRIVS_RECD This cannot be retrieved from a single view.id=c. c. A subset of 270 employees will be given a bonus of 270. END. c. ALTER TABLE FRUIT ENABLE PRIMARY KEY(ID) ALTER TABLE FRUIT Enable PRIMARY KEY(id)CASCADE.bonus%TYPE:=270.title. a. b.You have been given update privileges on the last_name column of the worker table. d.* 112.20.30).copy c WERE b.Which of the following ALTER commands reinstates a disabled primary constraint? a. BEGIN UPDATE worker SET bonus=bonus+v_bonus WHERE division_id IN (10. 113. All existing column values are verified to conform with the constraints and an error message is narrated if any existing values are not confirmed.Examine the automobile table: AUTOMOBILE Column name Key type Nulls/Unique FK table FK column Data type Length ID PK NN. c. UU MODEL STYLE Color NN NN NN NUM 9 CHAR 20 CHAR 20 CHAR 20 LOT_NO FK NN LOT LOT_NO NUM 3 Which SELECT statement will display the style. You disable the primary key constraint on the workid column and the check constraint on the job column. Which of the following is true? a. color. ALTER TABLE FRUIT ENALBE CONSTRAINT fruit_id_pk.Examine the structure of the pupil table: NAME PUP_ID NAME PHONE ADDRESS GRADUATION NULL? NOT NULL NOT NULL NOT NULL TYPE NUMBER(3) VARCHAR2(25) VARCHAR2(9) VARCHAR2(50) DATE There are over two hundred records in the pupil table. You cannot rename the column.lot_no FROM automobile WHERE model=UPPER(‘%model’). 117. #_9 24_bottles colors-1999 Slipper_#66* 116. Indexes on both columns with the primary key constraint and the check constraints are automatically recreated. ALTER TABLE FRUIT ADD CONSTRAINT fruit_id_pk PRIMARY KEY(id). The constraints must be recreated once they are disabled. SELECT style. b. . You can use the ALTER TABLE command with the RENAME COLUMN clause to rename the column. 114. You want to change the name of the graduation column to grad_date. b. and lot number for all cars based on model? a.You have been assigned the task of making major updates to the worker table. You can use the ALTER TABLE command with the MODIFY clause to rename the column. You can use the ALTER TABLE command with the MODIFY COLUMN clause to modify the column. d.Which of the following is a valid table name? a. b.c.color. 115. c. Existing rows that don’t conform with the constraints are automatically deleted. c. d. What happens when you try to enable the constraint after the update is completed? a. d. d. ‘Wallace’. GRANT CREATE SESSION. d.Examine the following DECLARE statement: DECLARE CURSOR work_cursor(p_divisionno NUMBER.birthdate. TO_DATE(‘13-jan-01’. OPEN work_cursor(p_divisionno. 119. CREATE TABLE. Davis. Both columns are defined with the DATE data type. d.b. OPEN work_cursor(‘clerk. d. CREATE PROCEDURE TO davis..color. c. TO_DATE(‘10-nov-52’.hiredate) VALUES(WORKNO_SEQ. INSERT INTO WORK(workno. Which of the following statements will insert the values into the table in the correct century? a. ‘DD-MON-YY’)). c. ‘Wallace’.p_job). b. Davis must create tables and packages in his own schema.The WORK table has columns designated for the birth date and hire date of all workers.wname.birthdate. CREATE PROCEDURE TO davis.lot_no FROM automobile WHERE model=’&model’. GRANT CREATE TABLE.CREATE TABLE. What command must be executed next to grant him these privileges? a. INSERT INTO WORK(workno. who was born in 1952 and hired in 2001.NEXTVAL. b. ‘10-nov-52’.hiredate) VALUES(WORKNO_SEQ. ‘manager’). ‘DD-MON-RR’)).. WNAME FROM WORK WHERE WORKNO=p_divisionno AND JOB=p_job BEGIN . OPEN work_cursor(10. CREATE PACKAGE TO davis. SELECT style. ‘DD-MON-RR’).color.wname. ’13-jan-01’) INSERT INTO WORK(workno..wname.birthdate. GRANT CREATE CONNECT.NEXTVAL. SELECT style.birthdate. ‘Wallace’. OPEN work_cursor.hiredate) VALUES(WORKNO_SEQ.lot_no FROM automobile WHERE UPPER ‘model’=UPPER(‘&model’). SELECT style.color. b. CREATE PROCEDURE TO davis. TO_DATE(‘13-jan-01’. ‘DD-MON-YY’). GRANT CREATE TABLE.hiredate) . you use the CREATE USER command to create an account for user. p_job VARCHAR2) IS SELECT WORKNO.lot_no FROM automobile WHERE UPPER ‘model’=(‘&model’).NEXTVAL.10). d. 120. TO_DATE(‘10-nov-52’. d. c.wname. INSERT INTO WORK(workno. 118. c.As DBA. Which statement opens the cursor successfully? a. You want to insert a row with the details of employee Wallace. d. PL/SQL table of scalars. 122.SUM(salary) FROM worker WHERE salary<50000 GROUP BY dept_no ORDER BY last_name. TO_DATE(‘10-nov-52’. AVG(sal) FROM work WHERE divisionno IN (3. PL/SQL table of records. %ROWTYPE variable.NEXTVAL. b. c. d. b. FROM employee WHERE salary<50000 GROUP BY dept_no ORDER by last_name 123. PL/SQL record. but only if the departments have an average salary of at least 3100? a. Which clause causes an error? a. ‘DD-MON-RR’)).6) GROUP BY divisionno HAVING AVG (sal)>=3100. SELECT divisionno. TO_DATE(‘13-jan-01’. AVG(sal) FROM work WHERE divisionno IN (3. AVG(sal) FROM work WHERE divisionno IN(3. ‘DD-MON-YYYY’). b.You must retrieve worker details from the work table and process them in a PL/SQL block. 121. c.6) GROUP BY AVG(sal) HAVING AVG(sal)>=3100 . c. Which variable type must be created in the PL/SQL block to retrieve all rows and columns using a single SELECT statement from the work table? a.last_name.Which of the following will display the average salary of divisions 3 and 6.Examine the following table: ID NO 7 6 4 3 2 5 1 8 LAST_NAME Brown Warner West Chalmers Landers Brunswick Lauder Ott FIRST_NAME Jerry James Dawn Mack Jillian Kate Susan Trixie SALARY 30000 25000 50000 32000 55000 DEPT_NO 255 233 102 145 233 145 You query the database using the following command: SELECT dept_no. SELECT divisionno. ‘Wallace’.6) AND AVG (sal)>=3100 GROUP BY divisionno.VALUES(WORKNO_SEQ. SELECT divisionno. b.” In the inventory table. ship date “Not shipped”. SELECT divisionno. NVL(TO=CHAR(shipdate) “Not NVL (To char(total). c. b. 126. ‘not available’)Shipped”) FROM order. Select inventory. UU MODEL STYLE Color NN NN NN NUM 9 CHAR 20 CHAR 20 CHAR 20 LOT_NO FK NN LOT LOT_NO NUM 3 You query the database with the following command: SELECT lot_number “lot number.You want to display data about all workers with the last name Randall. NVL (total. 124. Select inventory. Divisionno IN (3. first name.d. Select inventory. If an order has not been shipped.count(*) number of cars available” WHERE model= ‘e300’ GROUP BY lot_no HAVING COUNT (*)>10 125. Select inventory. To-CHAP (ship date.6). the report must indicate “not shipped. ‘Not ship’) To-CHAR (total. Select last name. Total “Not available” FROM order. “Not available”) FROM order.” If a total is not available.count(*) number of cars available” FROM automobile WHERE model= ‘e300’ GROUP BY lot_no HAVING COUNT (*)>10 ORDER BY COUNT (*). c. NVL (Ship date Not). the ship date column has a data type of date and the total column has a data type of number. Which clause restricts which groups are displayed? a. Which of the following statements should be used to create the report? a. Examine the automobile table: AUTOMOBILE Column name Key type Nulls/Unique FK table FK column Data type Length ID PK NN. SELECT lot_number “lot number. . AVG(sal) FROM work GROUP BY divisionno HAVNG AVG (sal)>=2000. the report must indicate “not available. FROM work WHERE last name=’randall’.You need to create a report to display the ship date and order totals of your inventory table. What statement will be successful? a. d. d. ‘Not available’) FROM order. but are not sure what case last names are stored in. c. c. The first name values in the database are in lower case.orderdate)) “Time Taken” FROM ord. SELECT custid. 129. Select last name. Charles has null commission. first name. c.You create the invoice table with the following command: CREATE TABLE invoice (purchase_no NUMBER(8) CONSTRAINT invoice-purchase-no-pk Customer_id NUMBER(8) CONSTRAINT invoice-customer-id-nk PRIMARY KEY. 127. ROUND(MONTHS-BETWEEN(shipdate. FROM work WHERE last name=UPPER (‘randall’).orderdate) “Time Taken”. date of order. SELECT custid. SELECT custid.b. You must create a report that displays the customer number. orderdate. b.commission worker commission (SELECT commission FROM employee WHERE UPPER(first-name)=’Charles’) Which of the following will cause this statement to fail? a. FROM work WHERE LOWER(lastname)=(‘smith’). d. shipdate ROUND OFF(shipdate-orderate) “Time Taken” FROM ord. NOT NULL). . shipdate. Select last name. Which statement meets these required results? a. d. b. shipdate ROUND(DAYS-BETWEEN(shipdate. date shipped. first name. orderdate.The worker table has the following columns: FIRST NAME COMMISSION VARCHAR2(20) NUMBER(3. orderdate.2) Evaluate the following statement: SELECT FROM WHERE first-name. SELECT custid. 128. FROM ord.Your manager requests that you analyze the time taken between when orders are taken and when they are shipped. first name. Select last name. d. and the number of months in whole numbers from the time the order is placed to the time the order is shipped. orderdate. FROM work WHERE UPPER(last name)=(‘randall’).orderdate))/30. There is no employee with the first name Charles. MONTHS-BETWEEN (shipdate. FROM ord. Charles has zero commission. shipdate. Too many foreign keys in the table.6). referring to the ID column in the division table? a. c. This statement will not fail. If this statement fails. b. d. No indexes are created. This cannot be done. which condition explains the failure? a. b. 130. Use the ALTER TABLE command with the ADD clause in the DETP table. d. CAR_ID FK NN CAR ID NUM 8 SALES_ID FK NN EMPLOYEE ID NUM 8 . b. An index is created for the customer_no column. Use the ALTER TABLE command with the MODIFY clause on the DEPT table. b. ALTER TABLE pupil MODIFY(name varchar2(20) NOT NULL). An index is created for each column. Missing mandatory column value.How would a foreign key constraint be added on the division_no column in the worker table.Which index or indexes are created for the invoice table? a. An index is created for the purchase_no column. c. ALTER TABLE pupil MODIFY CONSTRAINT name(NOT NULL) c.345. U NUM 8 CUSTOMER_ID FK NN CUSTOMER ID NUM 8 You issue the following command: INSERT INTO invoice(purchase_no. customer_id. 131. c. d. cars_id) VALUES(1234. Invalid data types in the statement. ALTER TABLE pupil ADD CONSTRAIONT NOT NULL (name). Use the ALTER TABLE command with the ADD clause on the EMP table. Which statement prevents NULL values from being entered into the Name column? a.Examine the table instance chart for the invoice table: INVOICE Column name Key type Nulls/Unique FK table FK column Data type Length PURCHASE_NO PK NN.Examine the structure of the pupil table: Name PUP ID NAME ADDRESS GRADUATION Null NOT NULL Type NUMBER(4) VARCHAR2(20) VARCHAR2(40) DATE The table is currently empty. ALTER TABLE pupil ADD CONSTRAINT name(NOT NULL). d. 132. SELECT wname. DELETE FROM patient WHERE id_number=&id_number / DEFINE: id_number DELETE FROM patient WHERE id_number=&id_number / DELETE DEFINE & id_number FROM patient WHERE id_number=&id_number This cannot be done.wname. d. They must be displayed in descending order. To restrict the output of a group function.For which three of these tasks would the WHERE clause be used? a.You must retrieve worker names and salaries from the work table. To only display data greater than a specified value.wname. Which statement should be used? a.wname. b. a.DESC. then the two names will be displayed in alphabetical order. If two names match for a salary. b.sal FROM work ORDER BY sal. SELECT wname. d. f. c. c. UU ID_NUMBER NUM 10 last_name first_name NN NN VARCHAR2 25 VARCHAR2 25 birth_date physician_id PHYSICIAN DATE NUM 10 Which of the following DELETE statements will del ete a patient from the table by prompting the user for the id_number of the patient to be deleted. b.Examine the patient table: PATIENT Column name Key type Nulls/Unique FK table FK column Data type Length Id_number PK NN. 135. e. SELECT wname. This cannot be done. To display unique data. d. To compare two values.sal FROM work ORDER BY sal. c. To restrict rows to be displayed. . To designate table location.133. 134.sal FROM work ORDER BY sal.
Copyright © 2024 DOKUMEN.SITE Inc.