To add to what Dave has said, how could you look up to see if anyone in the world has been vaccinated given an id, given two important details:
1) There is no global "People ID" which will uniquely identify a person in any system. It would probably make things a whole load simbler if there were ...
2) Access to any information on individuals is likely to be heavily restricted - and that includes vaccination status - because it will contain personal information. And local / global legislation generally provides severe penalties for releasing that without the persons consent: Google "GDPR" for one example.
If you are talking about your own database, then it's just a matter of issuing a parameterised SELECT query or similar (and being careful not to violate GDPR and other data protection legislation) but we can't tell you "do this" without knowing a lot more about your system and where / how the data is stored.
For SQL Server in C# it would be something like this:
using (SqlConnection con = new SqlConnection(strConnect))
using (SqlCommand cmd = new SqlCommand("SELECT Date1stJab, Date2ndJab FROM Vaccinations WHERE ID = @ID", con))
using (SqlDataReader reader = cmd.ExecuteReader())
DateTime first = (DateTime) reader["Date1stJab"];
DateTime second = (DateTime) reader["Date2ndJab"];