200 likes | 328 Views
Chapter 7 Reports. Concatenating Columns. Concatenation the process of combining two or more character columns into a single expression To concatenate type two vertical lines (||) between the column names. Using Concatenation. RTRIM Function.
E N D
Concatenating Columns • Concatenation • the process of combining two or more character columns into a single expression • To concatenate • type two vertical lines (||) between the column names
RTRIM Function • When the first name doesn’t include sufficient characters to fill the width of the column, SQL inserts extra spaces • To remove extra spaces, use the right trim function (RTRIM function) SELECT SLSREP_NUMBER, RTRIM(FIRST) || ‘ ‘ ||RTRIM(LAST) FROM SALES_REP;
CLEAR COLUMNS Command • Use CLEAR COLUMNS command to clear any previous column changes • Without this command any previous changes made to column headings would still be in place
COLUMN Command • Use COLUMN command to • change column headings • change width of a column • change the way entries appear in a column
TTITLE and BTITLE Command • TTITLE command • Adds a title to the top of the report • BTITLE command • Adds a title to the bottom of the report
SET LINESIZE Command • In order for the table to appear appropriately, adjust the line size by using the SET LINESIZE command • Line size determines where the title appears when it is centered across the line • SET LINESIZE 70 set the line to a length of 70 characters
Grouping Data in a Report • BREAK Command • Identifies a column or collection of columns on which to group data • Value of column is displayed only at the beginning of the group
Including Total and Subtotals in a Report • A total that appears after each group is called a subtotal • To calculate a subtotal, the BREAK command must be used to group the rows • Use the COMPUTE command to indicate the computation for the subtotal