How to show two tables in one query? part and the whole I have these two tables:
FinalExam

+----+------------+-------+
| id |   title    | score |
+----+------------+-------+
|  1 | math       | 12.67 |
|  2 | literature | 17    |
+----+------------+-------+

Quiz

+----+------+-----------+-------+
| id | feid | quiztitle | score |
+----+------+-----------+-------+
|  1 |    1 | midterm   |    14 |
|  2 |    1 | midterm2  |    11 |
|  3 |    2 | quiz1     |    16 |
|  4 |    1 | finalexam |    13 |
|  5 |    2 | finalexam |    18 |
+----+------+-----------+-------+

I want a result set where:

Quiz rows with the same feid are arranged together;
each row from FinalExam is added at the beginning of the corresponding feid group (Quiz.feid is a reference to FinalExam.id).

Expected output
For the above samples the result should look like this:

+----+------------+-------+
| id |   title    | score |
+----+------------+-------+
|  1 | math       | 12.67 |
|  1 | midterm    | 14    |
|  2 | midterm2   | 11    |
|  4 | finalexam  | 13    |
|  2 | literature | 17    |
|  3 | quiz1      | 16    |
|  5 | finalexam  | 18    |
+----+------------+-------+
Preparation sample data:

CREATE TABLE FinalExam(id INT, title VARCHAR(128), score FLOAT);

CREATE TABLE Quiz(id INT, feid INT, quiztitle VARCHAR(128), score FLOAT);

INSERT INTO FinalExam VALUES
(1,'math',12.67),
(2,'literature',17)

INSERT INTO Quiz VALUES
(1,1,'midterm',14),
(2,1,'midterm2',11),
(3,2,'quiz1',16),
(4,1,'finalexam',13),
(5,2,'finalexam',18)


Query to get result:

SELECT id,title,score
FROM (
    SELECT id, feid=id, title, score, final=CAST(1 AS BIT)
    FROM FinalExam

    UNION ALL

    SELECT id, feid, quiztitle, score, final=CAST(0 AS BIT)
    FROM Quiz
) A
ORDER BY feid,final DESC


Now you can see data in right order: final exam first then rest of quiz grades connecting with this final exam. You can delete ALL statement to allow your query delete duplicates.