def visitasPorSite(): con = Conexao() lista = (('DR-1', 'DR-3'), ) query = "SELECT DISTINCT st.name Site, vt.`date` DataVisita FROM Visited vt INNER JOIN Site st ON st.id = vt.site_id INNER JOIN Survey sv ON sv.visited_id = vt.id WHERE st.name IN %s;" result = con.getQuery(query, lista) print(result)
def sobrenomeDyr(): con = Conexao() query = "SELECT * FROM Person WHERE family LIKE '%DYR%';" result = con.getQuery(query) print(result)
def mtricasObservadas(): con = Conexao() query = "SELECT DISTINCT quant Metrica FROM Survey;" result = con.getQuery(query) print(result)
def pessoasMaisDoisLevantamentos(): con = Conexao() query = "SELECT DISTINCT ps.personal Pessoa, COUNT(sv.id) Levantamentos FROM Survey sv INNER JOIN Person ps ON ps.id = sv.person_id GROUP BY sv.person_id HAVING COUNT(sv.id) > 2;" result = con.getQuery(query) print(result)
def cidadesSemVisitas(): con = Conexao() query = "SELECT st.name Site FROM Site st LEFT JOIN Visited vt ON vt.site_id = st.id WHERE vt.id IS NULL;" result = con.getQuery(query) print(result)