Difference between revisions of "SQL Examples"
Jump to navigation
Jump to search
Line 1: | Line 1: | ||
While the SICdb dataset is provided as csv raw data, it is designed to be used in a a relational database management system. Refer to [[Get Started]] for further information building up the database and corresponding software. Our software also includes one-click SQL codes for hundreds of fields like creatinine on day one/two/..., | While the SICdb dataset is provided as csv raw data, it is designed to be used in a a relational database management system. Refer to [[Get Started]] for further information building up the database and corresponding software. Our software also includes one-click SQL codes for hundreds of fields like creatinine on day one/two/..., max/min/Average lactate and much more. | ||
Line 10: | Line 10: | ||
SELECT CaseID, d_references.ReferenceValue as Survived FROM `cases` LEFT JOIN d_references ON d_references.ReferenceGlobalID=cases.HospitalDischargeType; | SELECT CaseID, d_references.ReferenceValue as Survived FROM `cases` LEFT JOIN d_references ON d_references.ReferenceGlobalID=cases.HospitalDischargeType; | ||
=== Join Query including Unit-Of-Measurement === | === Join Query including Unit-Of-Measurement === | ||
[[File:ExampleLab.jpg|thumb|left]] | [[File:ExampleLab.jpg|thumb|left]] | ||
SELECT caseID,Offset,LaboratoryValue,d_references.ReferenceValue as LaboratoryName, d_references.ReferenceUnit as LabUnit FROM `laboratory` LEFT JOIN d_references ON d_references.ReferenceGlobalID=laboratory.LaboratoryID; | SELECT caseID,Offset,LaboratoryValue,d_references.ReferenceValue as LaboratoryName, d_references.ReferenceUnit as LabUnit FROM `laboratory` LEFT JOIN d_references ON d_references.ReferenceGlobalID=laboratory.LaboratoryID; |
Revision as of 09:53, 2 November 2022
While the SICdb dataset is provided as csv raw data, it is designed to be used in a a relational database management system. Refer to Get Started for further information building up the database and corresponding software. Our software also includes one-click SQL codes for hundreds of fields like creatinine on day one/two/..., max/min/Average lactate and much more.
Using Referenced Fields
One of the most important tasks is decoding the referenced fields. While our Software does this automatically the database design makes it also quite simple in raw SQL code.
Simple Join Query
SELECT CaseID, d_references.ReferenceValue as Survived FROM `cases` LEFT JOIN d_references ON d_references.ReferenceGlobalID=cases.HospitalDischargeType;
Join Query including Unit-Of-Measurement
SELECT caseID,Offset,LaboratoryValue,d_references.ReferenceValue as LaboratoryName, d_references.ReferenceUnit as LabUnit FROM `laboratory` LEFT JOIN d_references ON d_references.ReferenceGlobalID=laboratory.LaboratoryID;