Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.www.php > #20406

Re: Classe gestione database

Path csiph.com!weretis.net!feeder4.news.weretis.net!ecngs!testfeeder.ecngs.de!newsfeed.freenet.ag!newsfeed0.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Alessandro Pellizzari <shuriken@amiran.it>
Newsgroups it.comp.www.php
Subject Re: Classe gestione database
Date 23 Feb 2016 06:43:35 GMT
Lines 32
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>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 8bit
X-Trace individual.net HYtr7Fl2sdph8Pr6wiOU8gvjIJ1VwlkwyvojlxCc7LpGH+9gg=
Cancel-Lock sha1:scBwpjxnpHb7HDLiM7HZhRdbSgU=
User-Agent Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
Xref csiph.com it.comp.www.php:20406

Show key headers only | View raw


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 | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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