{"id":12,"date":"2005-11-21T20:00:24","date_gmt":"2005-11-22T01:00:24","guid":{"rendered":"http:\/\/blog.elharo.com\/blog\/software-development\/2005\/11\/21\/union-types-in-sql\/"},"modified":"2008-05-25T23:27:39","modified_gmt":"2008-05-26T04:27:39","slug":"union-types-in-sql","status":"publish","type":"post","link":"https:\/\/www.elharo.com\/blog\/software-development\/databases\/2005\/11\/21\/union-types-in-sql\/","title":{"rendered":"Union Types in SQL"},"content":{"rendered":"<p>XML schemas support a union type. For instance, you can say that an element must be an int or one of the strings &#8220;large&#8221;, &#8220;small&#8221;, or &#8220;huge&#8221;. Does SQL have any equivalent? That is, is it possible to type a field as containing either an int or one of an enumerated list of strings? Or do I just have to create two fields, one of which is null? How is this customarily handled in SQL?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>XML schemas support a union type. For instance, you can say that an element must be an int or one of the strings &#8220;large&#8221;, &#8220;small&#8221;, or &#8220;huge&#8221;. Does SQL have any equivalent? That is, is it possible to type a field as containing either an int or one of an enumerated list of strings? Or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[410],"class_list":["post-12","post","type-post","status-publish","format-standard","hentry","category-databases","tag-flash"],"_links":{"self":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/12","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/comments?post=12"}],"version-history":[{"count":0,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/12\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/media?parent=12"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/categories?post=12"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/tags?post=12"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}