Anda di halaman 1dari 7

SQR Skill Assessment for RMD.

Page 1 of 7

Candidate Name: Date:

1) What is the difference between: Print $some_var (1,1,0) and Print $some_var (+1,1,0) 2) What are some possible reasons for seeing an error like this:
(SQR 5528) DB2 SQL PREPARE/DECLARE error -204 in cursor 1: SQL0204N "DRO.DEALERSHIP" is an undefined name. SQLSTATE=42704 SQL: SELECT orgHier.GEOG_NM, dlrshp.DLR_CD, dlrshp.dlrshp_nm, agmt.APPNTD_DT, agmt.CNSCTV_TERM_NO FROM DRO.DEALERSHIP dlrshp, ..... .... Error on line 227: (SQR 3716) Error in SQL statement. Errors were found in the program file. SQR: Program Aborting.

3) What is the Load-Lookup structure in SQR useful for and when might you use it. 4) How is a Load-lookup table different from an Array 5) What is the difference between an ASK and an INPUT parameter. 6) let $var = SQR RULES print $var (1,1,5) print $var (+1,5,0) What will the output of these print statements be? (Type in the answer below) 7) For this questions assume you are given the following report to build. The requirements are that after each break in diversity type the total net profit and total number of dealers in the diversity type should be printed (the bolded values inside the squares). And at the end of the report a grand total should be printed. The diversity type should only be printed for the first dealer of that diversity type. Assume you are connecting to the following table:
Diversity_Dealers dd_id diversity_type region_cd start_dt dealer_cd dealer_nm address INTEGER VARCHAR VARCHAR DATE VARCHAR VARCHAR VARCHAR

SQR Skill Assessment for RMD.

Page 2 of 7

Candidate Name: Date:

city state_abr zip_code area_code phone_nbr first_nm middle_ini last_name net_profit

VARCHAR VARCHAR(2) VARCHAR(5) VARCHAR(3) VARCHAR VARCHAR VARCHAR VARCHAR INTEGER

Refer the mock up of the report below and write an SQR program that will use the above table to generate this report. (Note: dont worry about minor errors in syntax or getting the print placement parameters exactly correct. The idea here is to test your ability to use SQR to generate the report and meet the requirements.)

SQR Skill Assessment for RMD.

Page 3 of 7

Candidate Name: Date:

Diversity Dealers - Toyota & Lexus, June 11, 2007


Diversity Start Type Reg/PD Date Asian LA 02/14/92 LA 06/26/96 SF 01/09/96 SET 12/02/88 SET 04/11/97 LA 02/19/98 LA 05/28/91 SF 10/31/97 LA 04/19/96 LA 07/13/98 SF 08/28/97 GST 03/02/98 SET 10/13/98 WES 03/21/97 SET 03/02/98 LA 10/13/98 LA 12/23/96 SF 04/19/96 SET 06/20/94 KC 03/11/96 SET 01/18/96 SET 09/21/89 Dealer Code 01007 01013 01013 01017 01018 01018 01019 01026 01033 01037 01037 01051 01053 01055 01057 01058 01059 01060 01061 01062 01063 01064 22 03050 03051 03051 03052 03053 03054 03055 03056 03056 03057 03058 03059 04001 04001 04005 04006 16 Dealership Address City BILL PENNEY TOYOTA 4808 UNIVERSITY DR., N.W. HUNTSVILLE REINHARDT MOTORS, INC. 323 MOULTON STREET MONTGOMERY REINHARDT MOTORS, INC. 720 EASTERN BOULEVARD MONTGOMERY SPRINGHILL TOYOTA, INC. 3062 GOVERNMENT BOULEVARD OBILE M HOOVER TOYOTA, INC. 1595 MONTGOMERY HIGHWAY HOOVER HOOVER TOYOTA, INC. 1570 MONTGOMERY HIGHWAY HOOVER JOHN CRUMP TOYOTA 2801 HIGHWAY 69 EAST JASPER SCOTTSBORO TOYOTA 3011 S BROAD STREET SCOTTSBORO MCKINNON TOYOTA 1710 NORTH 7TH STREET CLANTON TOYOTA OF MONROEVILLE 223 N. MT. PLEASANT STR. MONROEVILLE TOYOTA OF MONROEVILLE 220 N MT PLEASANT ST MONROEVILLE PAT PECK TOYOTA 1613 FLORENCE BOULEVARD FLORENCE RAHAL TOYOTA, INC. 2329 ROSS CLARK CIRCLE DOTHAN PERFORMANCE TOYOTA, INC. 7680 AIRPORT BOULEVARD MOBILE BARGER TOYOTA HWY 280 BYPASS SYLACAUGA DYAS TOYOTA, INC. 1693 SOUTH COLLEGE STREET AUBURN SERRA TOYOTA, INC. 1300 CENTER POINT PARKWAY BIRMINGHAM PERFORMANCE TOYOTA-MAZDA 1104 BELTLINE, ROUTE 5 DECATUR LIMBAUGH TOYOTA, INC. 2200 AVENUE "T" BIRMINGHAM HERITAGE TOYOTA 563 E. MEIGHAN BLVD. GADSDEN PLANTATION TOYOTA HWY 431 NORTH EUFAULA SUNNY KING TOYOTA 1401 SOUTH QUINTARD AVE. ANNISTON ST AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL AL Zip Area Code Code Phone # 35816 256 2135489 36104 843 3515987 36117 594 5482459 36606 856 2135489 35216 318 2549875 35216 548 2516357 35501 328 8547853 35768 618 6598742 35045 749 3515987 36460 166 3658975 36460 256 2135489 35630 843 2549875 36301 594 2516357 36605 856 8547853 35150 318 6598742 36830 548 3515987 35215 328 3658975 35602 618 5482459 35218 749 2135489 35902 166 2549875 36027 480 2516357 36202 2485 8547853 First Name MI DAVID A RICHARD R RICHARD VIRGIL L MATTHEW BARBARA LEO LEO R LEO R THOMAS M SCOTT M VAN G DONALD B FRANK D L G RONALD&CARO.G JAMES RICHARD G CAROL DORIS K DORIS P TROY L Last Name BOCH BOCH, JR BOCH, SR. BOCKER BODINE BOESE BOESE III BOESE III BOESE, III BOHLMAN BOHN BOHN BOHN, JR BOLEA BOLEN BOMERS BONACCI BOND BONE BONE BONE BONE JR Net Profit 7/2007 YTD $1,881,277 $1,638,369 $1,620,621 $1,480,807 $1,465,136 $1,401,047 $1,394,080 $1,381,781 $1,292,631 $1,099,287 $868,333 $860,091 $555,860 $549,745 $518,286 $461,544 $445,159 $255,242 $203,562 $155,016 $129,398 $107,579 $19,764,850 $1,833,393 $1,615,652 $1,611,817 $1,534,004 $1,375,338 $1,370,031 $1,158,687 $1,077,180 $949,509 $685,057 $585,994 $561,185 $292,119 $113,734 $98,290 $54,227 $14,916,217

African- GST American GST KC GST NY GST BOS CAT GST KC GST GST SF SF LA LA

10/01/96 12/08/97 12/09/92 11/11/91 09/19/97 10/05/89 02/27/90 02/09/98 07/15/91 12/19/94 08/07/97 10/31/96 02/19/93 08/01/97 01/28/98 05/16/96

J. PAULEY TOYOTA 6200 SOUTH 36TH STREET COURTESY OLDS-TOYOTA-GMC621 S. KNOXVILLE COURTESY OLDS-TOYOTA-GMC720 S. KNOXVILLE TEAGUE TOYOTA-CHEVY-OLDS1830 WEST HILLSBORO PHIL WRIGHT TOY-CHEV CO. 19TH & SOUTH ARKANSAS TODD ROONEY TOY GMC OLDS 1800 SOUTH DIVISION CONWAY TOYOTA 1110 COLLIER DRIVE LIBERTY TOYOTA 2520 E. BROADWAY LIBERTY TOYOTA 2714 E. BROADWAY LITTRELL TOYOTA 300 N. BROADWAY TROTTER TOYOTA 3010 AUTO DRIVE BALE TOYOTA 1110 COLLIER DRIVE RON GOODE TOYOTA, INC. This is a test RON GOODE TOYOTA, INC. 1815 CLEMENT ST BOB BAKER TOYOTA-LEMON GR 6800 FEDERAL BOULEVARD SOUTAR'S 631 W MAIN ST

FORT SMITH RUSSELLVILLE RUSSELLVILLE EL DORADO RUSSELLVILLE BLYTHEVILLE CONWAY WEST MEMPHIS WEST MEMPHIS BLYTHEVILLE PINE BLUFF CONWAY ALAMEDA ALAMEDA LEMON GROVE BARSTOW

AR AR AR AR AR AR AR AR AR AR AR AR CA CA CA CA

72903 72801 72801 71730 72801 72315 72032 72301 72301 72315 71601 72032 94501 10000 91945 92311

256 843 594 856 318 548 328 618 749 166 256 843 594 856 318 548

2516357 8547853 6598742 3515987 3658975 5482459 2135489 2549875 2516357 3515987 3658975 5482459 2135489 2549875 2516357 8547853

RAYMOND DAN W.B. DON VINCENT WILLIAM JAMES JOSEPH LAYTON JACK PATTI JACK ROBERT GLENN DENISE DORIAN

F L J F A J C J C A

BOURNE BOUTTE BOVARD BOWEN BOWEN BOWEN BOWER BOWERS BOWERS BOWKER BOWKER BOWKER JR BOWLING BOYD BOYLAND BOYLAND

Total 95
$34,681,067

SQR Skill Assessment for RMD.

Page 4 of 7

Candidate Name: Date:

7) True or False, the SQR syntax does allow for a GOTO control structure. 8) What do the RTRIM and RPAD functions do? 9) Write an SQR program that offers a local procedure that allows a user to form a single string that will contain the value of a persons full name, Darrin Alan Miller for example. The SQR program should: A. Prompt the user for a persons first name, middle name, and last name B. Allow the user to enter the aforementioned values in upper, lower, or mixed case C. Prompt the user for the style of name they want to see (LFM, FML, LF, FL) D. Prompt the user with a choice whether or not they want the middle name portion of the resulting name to be abbreviated or not. If the user wants the abbreviated version of the middle name, then that name must be followed with a period. E. Return the persons full name with each word having its first character capitalized. F. If a persons last name is the first portion of the full name string created, then that last name should be followed by a comma and appropriately spaced G. Although the user may be requesting to see the persons middle name as part of the full name variable that is created, if the middle name is null (and it can be), then the logic for making this name part of the full name variable should be omitted. First Name DARRIN Darrin Darrin Middle Name Alan AlAN Last Name Miller Miller miller Style Abbr MN LFM Y FML Y FML Y Result Miller, Darrin A. Darrin Miller Darrin A. Miller

10) True or False, the attributes associated with a chart as declared within the DECLARE-CHART definition of an SQR program may be overridden by corresponding attributes within the PRINT-CHART command. 11). The creation of charts within an SQR program requires the use of what type of in memory data type: A. An array B. A load-lookup C. A file D. A cursor E. A select statement 12) True or False, the use of arrays within an SQR program should be avoided because they can not be dynamically sized and therefore may obtain more OS memory than needed. 13) What are the methodologies available to pass user parameters into an SQR program? A. INPUT B. PROMPT C. ASK

SQR Skill Assessment for RMD.

Page 5 of 7

Candidate Name: Date:

D. E. F. G.

Choices A and B above Choices B and C above Choices A and C above All of the above

14) True or False, user parameters passed to an SQR program via the INPUT command retrieve a compile-time substitution variable. 15) Within a BEGIN-SQL paragraph various DDL and DML commands such as creates, drops, updates, etc. can be issued against the RDBMS. The ability to issue these types of commands is determined and constrained by the A. RDBMS privileges assigned to the database administrator B. RDBMS privileges assigned to Dan Thornhill C. RDBMS privileges assigned to the user executing the SQR program D. roles, grants, and synonyms assigned to the user executing the SQR program E. SQR program designer 16) Which SQR section is responsible for defining and controlling information that is to be printed at the top of each output page? 17) An & variable within SQR A. May represent and store a numeric value selected from the RDBMS B. May represent and store a string value selected from the RDBMS C. Is a read only variable D. A, B, and C above E. None of the above 18) Referring to the excerpt of SQR code that follows and assuming that the procedure queried 10 rows of data and that each row possessed a value of 10.00 for the PROD_PRICE column, what will be the value of the #product_total variable that is displayed?
BEGIN-PROCEDURE CALC_FIGURES LET #PRODUCT_TOTAL = 100 BEGIN-SELECT PROD_CODE &PROD_CODE PROD_PRICE &PROD_PRICE LET #PRODUCT_TOTAL = (#PRODUCT_TOTAL + &PROD_PRICE) FROM PRODUCTS WHERE PROD_CODE = 1709 END-SELECT DISPLAY #product_total END-PROCEDURE

19) Referring to the excerpts of SQR code that follow, will the contents of #PROD_TOTAL in both excerpts be the same after program execution has completed?

SQR Skill Assessment for RMD.

Page 6 of 7

Candidate Name: Date:

BEGIN-PROCEDURE CALC_FIGURES BEGIN-SELECT PROD_CODE &PROD_CODE PROD_PRICE &PROD_PRICE LET #PROD_TOTAL = (#PROD_TOTAL + &PROD_PRICE) FROM PRODUCTS WHERE PROD_CODE = 1709 END-SELECT END-PROCEDURE

BEGIN-PROCEDURE CALC_FIGURES BEGIN-SELECT PROD_CODE &PROD_CODE SUM(PROD_PRICE) &PROD_TOTAL MOVE &PROD_TOTAL TO #PROD_TOTAL FROM PRODUCTS WHERE PROD_CODE = 1709 END-SELECT END-PROCEDURE

20) & variables within SQR are assigned during the processing of what type of SQR paragraph? A. BEGIN-SQL B. BEGIN-PROCEDURE C. BEGIN-ERROR D. BEGIN-SELECT E. BEGIN-PROGRAM Use the following excerpts of SQR code to answer following questions.
Program Excerpt A: BEGIN-PROCEDURE GET_CUSTOMERS BEGIN-SELECT C.NAME (1,1) O.ORDER_DATE (1,35) O.ORDER_NUM (1,50) NEXT-LISTING FROM CUSTOMERS C, ORDERS O WHERE C.CUST_NUM = O.CUST_NUM ORDER BY C.NAME END-SELECT END-PROCEDURE Program Excerpt B: BEGIN-PROCEDURE BEGIN-SELECT C.NAME C.CUST_NUM DO GET_ORDERS FROM CUSTOMERS C ORDER BY C.NAME END-SELECT END-PROCEDURE GET_CUSTOMERS (+1,1) &LE_NUMBER

BEGIN-PROCEDURE GET_ORDERS BEGIN-SELECT O.ORDER_DATE (0,35) O.ORDER_NUM (0,50) FROM ORDERS WHERE CUST_NUM = &LE_NUMBER END-SELECT END-PROCEDURE

21) The &LE_NUMBER portion of code is known as a: A. blind variable B. bound variable C. flexible variable D. bind variable E. substitution variable 22) If the CUSTOMERS table contains 20 rows, and the ORDERS table contains 20 rows, and these tables have 10 rows with matching CUST_NUM values, will both programs achieve the same results? 23) The code within Program Excerpt B can be described as: A. a correlated sub-query

SQR Skill Assessment for RMD.

Page 7 of 7

Candidate Name: Date:

B. C. D. E.

a cascading query a join query a cluster query a goto query

24) How many distinct queries are being issued to the RDBMS within Program Excerpt B 25) Modify the excerpts of SQR code above related to the previous questions so that possible errors encountered from the RDBMS will be handled.

Anda mungkin juga menyukai