/* For ORACLE and PostgreSQL, and some other DBs, union columns must have similar datatypes */ /* So text columns must be union with text columns, and the same for numeric columns */ /* If the column types are not similar, you must force their datatypes to change */ select fname, lname, '--' as id, ssn, 'instructor' as type from instructor UNION select fname, lname, TO_CHAR(student_id,'999'), ssn, 'student' from student order by type