Showing posts from November, 2019

Check constraint that is a field has a particular value ensure that another field must be filled in.

DB time! So this post regards "normalisation", or lack of, permitting me to be more lazy, and have simpler databases - what's not to like? I had a DB table "users", and two distinct classes of user:  Adult and Child.  Now the business logic demands that the Adult users have an email address entered, whereas the child user doesn't necessarily need one. The Boyce-Cod or whatever blah blah method would be to have 2 tables, but that means loads of JOINs, the inability to view the entire user list in one place, and more logic everywhere. I'd prefer to have 1 table "Users", but how to enforce the business logic above? So I've discovered a way - using CHECK CONSTRAINTS in MS SQL 2012+ The "redmouse" is a child user, it is optional whether he has a email address or not. ([role]='Adult' AND [emailaddress] IS NOT NULL OR ([role]='Child' AND [emailaddress] IS NOT NULL OR [role]='Child' AND [ema

Another one live. Cloudlingo

 I've done a " Cummings " here and back-dated this post :) My reasoning is less nefarious however.  I just don't want anyone but Google to read it just now. Background So back in approximately November 2019 I'd never heard of Corona Virus and life was grand with Bed and doing OK. I was having weekly meetings with my Andorran mate Toni.  He's a cool guy and works for the local telco.  We'd been getting together for several years once a week for Spanish-English intercambio. I'd taken to bringing some lyrics from a Spanish song that I'd heard and liked, and we'd translate it. My plan was to do a site that involved learning Spanish via the music. I'd originally had the germ of this thought probably more than 10 years prior.  When we first got to Spain and were living in Valls I remember loving some songs that were around then and making a mix CD to play in the car. Marta Sanchez y Carlos Baute - Colgando en tus manos (hanging i