Tuesday, October 23, 2007

What kind of join am I? (example SQL code)

Create Table Fred
( TheID INTEGER
, TheName VARCHAR(20)
)

Create Table Jobs
( TheID INTEGER
, TheJob VARCHAR(20)
)

INSERT INTO Fred VALUES (1, 'Fred')
INSERT INTO Fred VALUES (2, 'Freddy')
INSERT INTO Fred VALUES (3, 'Fredrick')

INSERT INTO Jobs VALUES (1, 'Boss')
INSERT INTO Jobs VALUES (4, 'Slave')

SELECT F.TheID, F.TheName, J.TheID, J.TheJob
FROM Fred F
INNER JOIN Jobs J On J.TheID = F.TheID

SELECT F.TheID, F.TheName, J.TheID, J.TheJob
FROM Fred F
RIGHT JOIN Jobs J On J.TheID = F.TheID

SELECT F.TheID, F.TheName, J.TheID, J.TheJob
FROM Fred F
LEFT JOIN Jobs J On J.TheID = F.TheID

Friday, October 12, 2007

Tuesday, October 02, 2007

Now we have a medical reason to eat chocolate

BBC NEWS | Health | Chocolate 'aids fatigue syndrome':
Patients in a pilot study found they had less fatigue when eating dark chocolate with a high cocoa content than with white chocolate dyed brown. Researchers from Hull York Medical School said the results were surprising but dark chocolate may be having an effect on the brain chemical serotonin.