From: Rick James Date: October 19 2012 6:42pm Subject: RE: Schemas for storing and reporting on hashtags List-Archive: http://lists.mysql.com/mysql/228466 Message-Id: <2E7DD7ADE53B044C8C8BCD9C5829E1EB1490E798F2@SP2-EX07VS01.ds.corp.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Many-to-many? That is, can a comment have many different hashtags? And a = hashtag can be associated with many comments? Best practice for many-to-many: CREATE TABLE xyz ( hashtag VARCHAR(...) NOT NULL, comment_id ... NOT NULL, PRIMARY KEY (hashtag, comment_id), INDEX(comment_id, hashtag) ) ENGINE =3D InnoDB; One might want to "normalize" the hashtags, but it does not seem warranted = in this situation. > -----Original Message----- > From: Hank [mailto:heskin@stripped] > Sent: Friday, October 19, 2012 8:58 AM > To: MySql > Subject: Schemas for storing and reporting on hashtags >=20 > Are there any established "best practices" or schemas for incorporating > twitter-like hashtags into a database ? >=20 > Let's say I have a blog with a commenting system, and I want to allow > people to add hashtags to the comments. >=20 > I could certainly create one on my own (it's not that difficult), but > I'd like to see what other people have done in terms of storage and > features. >=20 > I'm also looking for a solid basic implementation, not something overly > complex. >=20 > Thanks, >=20 > -Hank >=20 > (query, mysql) >=20 > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/mysql