nerdexam
Oracle

1Z0-909 · Question #47

Examine this bar graph based on columns from the players table: Which two statements would generate this bar graph?

The correct answer is A. SELECT Name, Gender, Sport, REPEAT('# 'Y GPA*10) AS GPA_Graph FROM players ORDER D. SELECT Name, Gender, Sport, RPAD ('# ' GPA*10) AS GPA_Graph FROM players ORDER BY. Options A and D are correct because they use functions that generate repeated characters to visually represent GPA as a bar: REPEAT('# ', GPA10) repeats the '# ' string exactly GPA×10 times (e.g., a 3.5 GPA produces 35 # characters), while RPAD pads a string out to a target…

SQL Fundamentals

Question

Examine this bar graph based on columns from the players table:

Which two statements would generate this bar graph?

Exhibit

1Z0-909 question #47 exhibit

Options

  • ASELECT Name, Gender, Sport, REPEAT('# 'Y GPA*10) AS GPA_Graph FROM players ORDER
  • BSELECT Name, Gender, Sport, LENGTH (GPA*10, '# ') AS GPA_Graph FROM players ORDER
  • CSELECT Name, Gender, Sport, CHAR_LENGTH ('# ' GPA*10) AS GPA_Graph FROM players
  • DSELECT Name, Gender, Sport, RPAD ('# ' GPA*10) AS GPA_Graph FROM players ORDER BY
  • ESELECT Name, Gender, Sport, CONCAT ('# ' GPA*10) AS GPA_Graph FROM players ORDER

How the community answered

(19 responses)
  • A
    79% (15)
  • B
    5% (1)
  • C
    5% (1)
  • E
    11% (2)

Explanation

Options A and D are correct because they use functions that generate repeated characters to visually represent GPA as a bar: REPEAT('# ', GPA*10) repeats the '# ' string exactly GPA×10 times (e.g., a 3.5 GPA produces 35 # characters), while RPAD pads a string out to a target length using a fill character - both produce a proportional bar of # symbols in the result set.

Options B (LENGTH) and C (CHAR_LENGTH) are wrong because those functions measure the length of an existing string - they return an integer, not a generated bar of characters. Option E (CONCAT) is wrong because it simply joins '# ' and the numeric GPA value as a literal string (e.g., "# 3.5"), not a repeated pattern proportional to the GPA.

Memory tip: Bar graphs need repetition, so think "R for Replicate" - the two correct answers both start with R (REPEAT and RPAD). Any function that only counts characters (LENGTH, CHAR_LENGTH) or joins fixed strings (CONCAT) cannot dynamically build a proportional bar.

Topics

#String functions#REPEAT/RPAD#SELECT queries#Data formatting

Community Discussion

No community discussion yet for this question.

Full 1Z0-909 Practice