A simple user meta row can handle that for you (the second issue), you can store the post id and the vote (up/down) in an array and that is just the same as post meta ex
/**
* update user vote per post
* @param int $user_id
* @param int $post_id
* @param mixed $vote can be an integer 1 / -1 and can also be a string "up"https://wordpress.stackexchange.com/"down"
* @return void
*/
function update_user_vote($user_id,$post_id,$vote){
//get all saved user data
$user_votes = get_user_meta($user_id,'updown_votes',true);
$user_votes[$post_id] = $vote;
//update with the new vote
update_user_meta($user_id,'updown_votes',$user_votes);
}
/**
* get user vote of post
* @param int $user_id
* @param int $post_id
* @return if user has voted the his vote will be returned , zero if no vote found for post by this user
*/
function get_user_vote($user_id,$post_id){
//get all saved user data
$user_votes = get_user_meta($user_id,'updown_votes',true);
return (isset($user_votes[$post_id])) ? $user_votes[$post_id] : 0;
}
and all done with no SQL 🙂