Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > it.comp.www.php > #20406
| From | Alessandro Pellizzari <shuriken@amiran.it> |
|---|---|
| Newsgroups | it.comp.www.php |
| Subject | Re: Classe gestione database |
| Date | 2016-02-23 06:43 +0000 |
| Message-ID | <dj2dcnFa96jU1@mid.individual.net> (permalink) |
| References | <nac5sv$r5o$1@gioia.aioe.org> <naf6pe$jdf$1@gioia.aioe.org> <naffb9$sj5$1@virtdiesel.mng.cu.mi.it> |
Il Mon, 22 Feb 2016 18:08:57 +0100, Andrea D'Amore ha scritto: > Dato che immagino tu stia usando un db relazionale, crea una bella > tabella Tags(_id_, name) e poi crea una relazione molti-a-molti tra le > due tabelle. Nel caso specifico dei tag io nel tempo mi sono stabilizzato su una delle due soluzioni: 1: create table oggetto (id int auto_increment, ...) create table tag (tag varchar unique) create table oggetto_tag (id_obj int FK, tag varchar FK) 2: create table oggetto (id int auto_increment, ...) create table oggetto_tag (id_obj int FK, tag varchar) Senza "tabella base", ma normalizzando i tag (mb_strtolower, replace di spazi con - o _, ecc.) Sempre più spesso uso la 2, visto che la 1 aggiunge solo overhead sul DB. La soluzione con "table tag (id, name)" non la uso perchè il tag è già primary key, non serve un id. Bye.
Back to it.comp.www.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Classe gestione database "Franco Af" <nonvalidanonvalidanonvalida@falsa.com> - 2016-02-21 12:09 +0100
Re: Classe gestione database Alex <tommaso5ita@yahoo.it> - 2016-02-21 13:49 +0100
Re: Classe gestione database fmassei@gmail.com - 2016-02-21 10:28 -0800
Re: Classe gestione database "Franco Af" <nonvalidanonvalidanonvalida@falsa.com> - 2016-02-22 15:42 +0100
Re: Classe gestione database Andrea D'Amore <anddam+NOSPAM@brapi.net> - 2016-02-22 18:08 +0100
Re: Classe gestione database Alessandro Pellizzari <shuriken@amiran.it> - 2016-02-23 06:43 +0000
Re: Classe gestione database Andrea D'Amore <anddam+NOSPAM@brapi.net> - 2016-02-23 08:45 +0100
Re: Classe gestione database "Franco Af" <nonvalidanonvalidanonvalida@falsa.com> - 2016-02-23 13:53 +0100
Re: Classe gestione database Alessandro Pellizzari <shuriken@amiran.it> - 2016-02-23 14:16 +0000
csiph-web