Omit made up columns from results
There is no need to use VALUES; simplify the insert to

INSERT INTO t (class_id, teacher_id, student_id)
    SELECT id, 1, 1 FROM ...


To get rid of extra columns, make an extra level of SELECT:

SELECT a, b
    FROM (
        SELECT a, extra, b FROM ...
         ) AS x


But, you probably won't have any extra columns if you do

ORDER BY
    IF (`name` = "John Smith", 2, 
        IF (`name` RLIKE "[[:&lt;:]]John Smith[[:&gt;:]]", 1,
            MATCH (`name`) AGAINST ("John Smith")
       )   )