Question: What party did the incumbent from the Virginia 5 district who was Re-elected and was first elected in 1797 belong to?
SQL: SELECT "Party" FROM "1-2668401-17" WHERE "Result" = 'Re-elected' AND "First elected" = '1797' AND "District" = 'Virginia 5';

Question: When was the incumbent first elected in the district where the result was a Democratic-Republican gain? 
SQL: SELECT "First elected" FROM "1-2668401-17" WHERE "Result" = 'Democratic-Republican gain';

Question: In what district was the incumbent Edwin Gray? 
SQL: SELECT "District" FROM "1-2668401-17" WHERE "Incumbent" = 'Edwin Gray';

Question: When was the incumbent from the Virginia 10 district first elected? 
SQL: SELECT "First elected" FROM "1-2668401-17" WHERE "District" = 'Virginia 10';