Selection Lists
When you use a SELECT statement to retrieve data, you specify a list of columns (a selection list) to include in the result table. To retrieve all the columns in a table or tables, you can use an asterisk (*) instead of a list of columns.
*Note: Avoid using * in place of the list. Using * can expose an application to potential problems if the number of columns or column sizes in a table changes. Also, it typically returns unnecessary data.
The following example selects three columns from the Class table.
SELECT Name, Section, Max_Size
FROM Class;
The following example selects all columns from the Class table.
SELECT * FROM Class;
When retrieving data, Pervasive PSQL displays column names based on how you specify the names in the query.
SELECT name, section, max_size FROM Class#
Pervasive PSQL returns the column names as follows:
"Name", "Section", "Max_Size"
These column names are headings for the returned data; they are not data themselves.
The following example defines aliases for the tables Department and Faculty.
SELECT d.Name, f.ID FROM Department d, Faculty f;
Pervasive PSQL returns the column names as follows:
"Name", "ID"
SELECT * FROM Department;
Pervasive PSQL returns the column names as follows:
"Name", "Phone_Number", "Building_Name", "Room_Number", "Head_Of_Dept"
The following example defines aliases for the tables Department and Faculty.
SELECT * FROM Department d, Faculty f;
Pervasive PSQL returns the column names as follows:
"Name"
"Phone_Number"
"Building_Name"
"Room_Number"
"Head_Of_Dept"
"ID"
"Dept_Name"
"Designation"
"Salary"
"Building_Name"
"Room_Number"
"Rsch_Grant_Amount"