def askCity(id_country): if id_country == 'null': sql = "SELECT people.ID_PERSON, people.CITY FROM people WHERE people.ID_COUNTRY > 0" name = selectDB(sql) n = random.randint(0,len(name)-1) return name[n] else: sql = "SELECT people.ID_PERSON, people.CITY FROM people WHERE people.ID_COUNTRY = {}".format(id_country) name = selectDB(sql) return name
def askArea(id_per): if id_per == 'null': sql = "SELECT people.ID_PERSON, people.AGE FROM people WHERE people.ID_PERSON > 0" cons = selectDB(sql) ran = random.randint(0,len(cons)-1) return cons[ran] else: sql = "SELECT people.ID_PERSON, people.AGE FROM people WHERE people.ID_PERSON = {}".format(id_per) cons = selectDB(sql) return cons
def askNameMedal(id_med): if id_med == 'null': sql = "SELECT medals.ID_MEDAL, medals.NAME_MEDAL FROM medals WHERE medals.ID_MEDAL > 0" name = selectDB(sql) num =random.randint(0, len(name)-1) return name[num] else: sql = "SELECT medals.ID_MEDAL, medals.NAME_MEDAL FROM medals WHERE medals.ID_MEDAL = {}".format(id_med) name = selectDB(sql) return name
def askNameCountry(id_coun): if id_coun == 'null': sql = "SELECT countries.ID_COUNTRY, countries.NAME_COUNTRY FROM countries WHERE countries.ID_COUNTRY > 0 " name = selectDB(sql) num = random.randint(0,len(name)-1) return name[num] else: sql = "SELECT countries.ID_COUNTRY, countries.NAME_COUNTRY, people.ID_COUNTRY, people.GENDER FROM countries,people WHERE countries.ID_COUNTRY = people.ID_COUNTRY AND people.GENDER = '{}'".format(id_coun) name = selectDB(sql) return name
def askAgePeople(id_per): if id_per == "null": sql = "SELECT people.ID_PERSON, people.AGE FROM people WHERE people.ID_PERSON > 0" name = selectDB(sql) n = random.randint(0,len(name)-1) return name[n] else: sql = "SELECT people.ID_PERSON, people.AGE FROM people WHERE people.ID_PERSON = {}".format(id_per) name = selectDB(sql) return name
def askCategories(id_cat): if id_cat == 'null': sql = "SELECT categories.ID_CATEGORIES, categories.NAME FROM categories WHERE categories.ID_CATEGORIES > 0" name = selectDB(sql) nu = random.randint(0,len(name)-1) return name[nu] else: sql = "SELECT categories.ID_CATEGORIES, categories.NAME FROM categories WHERE categories.ID_DEPORT = {}".format(id_cat) name = selectDB(sql) return name
def askDeport(id_depo): if id_depo == 'null': sql = "SELECT deports.ID_DEPORT, deports.NAME_DEPORT FROM deports WHERE deports.ID_DEPORT > 0" name = selectDB(sql) nu = random.randint(0,len(name)-1) return name[nu] else: sql = "SELECT deports.ID_DEPORT, deports.NAME_DEPORT FROM deports WHERE deports.ID_DEPORT = {}".format(id_depo) print('\nEn qué deporte participo el medallista? ') name = selectDB(sql) return name
def isPeople(id_gen,id_count,id_city): sql = "SELECT people.ID_PERSON, people.FULL_NAME, countries.ID_COUNTRY FROM people, countries WHERE people.GENDER = '{0}' AND countries.ID_COUNTRY = {1} AND people.CITY = '{2}'".format(id_gen,id_count,id_city) res = selectDB(sql) if len(res) == 0: print('No hay datos') return 'null' else: # print(f'{res[0][1]}') print("\nEs acaso '{}' en quien pensabas?".format(res[0][1])) return res
def askYearGame(): sql = 'SELECT olympic_games.ID_OLYMPIC_GAME, olympic_games.YEAR FROM olympic_games WHERE ID_OLYMPIC_GAME > 0' print('\nEn que año participo el medallista?') year = selectDB(sql) return travelTable(year)
def askOlympicGame(): print('\nEn que Juego Olimpico participo el medallita?') sql = 'SELECT olympic_games.ID_OLYMPIC_GAME, olympic_games.COUNTRY FROM olympic_games WHERE ID_OLYMPIC_GAME > 0' name = selectDB(sql) return travelTable(name)
def askGenderPeople(): sql = "SELECT people.ID_PERSON, people.Gender FROM people WHERE people.ID_PERSON > 0" name = selectDB(sql) return travelTable(name)