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.
SELECT student_number, title, forename, surname, date_of_birth
WHERE student_number = 'L0001234';
could return the result:
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.