Buongiorno a tutti,
ho una domanda da fare, ho già guardato alcuni siti per esempi in merito, mi è tutto chiaro fino ad un certo punto.
Ho un database con un'unica tabella,che chiamo TABELLA1 che include per esempio questi campi:
id
nome_giocatore
nome_squadra
anno
presenze
Vorrei ora alleggerire il peso di questa tabella, anche per rendere piu veloci le query,creando più tabelle, ovvero:
TABELLA SQUADRA:
id_squadra
nome_squadra
TABELLA GIOCATORE:
id_giocatore
nome_giocatore
Quindi la nuova TABELLA1 sarà:
id_giocatore
id_squadra
anno
presenze
Io creo le id come tipo INT, UNSIGNED, NOT NULL, AUTO_INCREMENT e chiave primaria,è corretto innanzitutto?
Questa è la query che attualmente uso nel mio sito:
Codice PHP:
$lettura_risultati=mysql_query("select id, nome_utente, tipo_struttura, nome_struttura, naz_struttura, luogo_struttura, mese_sogg, anno_sogg, titolo_rec, voto_struttura, voto_qualita_cam, voto_ristorante, voto_pulizia, voto_eff_servizi, testo_rec, date_format(data_ora_ins, '%d/%m/%Y - ore %H:%i:%s') as data_formattata, MATCH(nome_struttura, tipo_struttura, naz_struttura, luogo_struttura) AGAINST('". $_POST['nome_ric'] ." ". $_POST['tipo_ric'] ." ". $_POST['naz_ric'] ." ". $_POST['luogo_ric'] ."' IN BOOLEAN MODE) AS tot from recensioni where MATCH(nome_struttura, tipo_struttura, naz_struttura, luogo_struttura) AGAINST('". $_POST['nome_ric'] ." ". $_POST['tipo_ric'] ." ". $_POST['naz_ric'] ." ". $_POST['luogo_ric'] ."' IN BOOLEAN MODE) order by tot DESC");
Come faccio a fare una query dove a video mi farà vedere il campo descrittivo nome_squadra(per esempio) e nome_giocatore?Come faccio a legare i campi di piu tabelle nella query?
Grazie mille e buona giornata