Skip to main content

Column Headings

When practicing your SQL commands you would have noticed that the column headings displayed are almost, but not exactly, the same as the columns defined in your SQL SELECT command.

For example:

SELECT student_number, title, forename, surname, date_of_birth

FROM student

WHERE student_number = 'L0001234';

could return the result:

L0001234 Mr Trevor Jones 07-SEP-74

The rules for the headings are:

  • The name used is the column name.
  • The heading is displayed in upper case.
  • The maximum length displayed is the lesser of (a) the number of characters in the column name and (b) the defined size of the column. In the above example, 'student_number' is 14 characters in length but defined as CHAR(8). So, the first eight characters of the name are displayed. Similarly, 'title' is five characters in length but defined as CHAR VARYING(4). Therefore, only the first four characters, 'TITL', are displayed. A method to resolve this problem is described in the next section.
  • Headings of date columns occupy nine places.

Next: Combining Functions