{"id":3363,"date":"2016-02-02T23:29:55","date_gmt":"2016-02-02T14:29:55","guid":{"rendered":"https:\/\/jirak.net\/wp\/new-and-old-ways-to-emulate-check-constraints-domain\/"},"modified":"2016-02-02T23:29:55","modified_gmt":"2016-02-02T14:29:55","slug":"new-and-old-ways-to-emulate-check-constraints-domain","status":"publish","type":"post","link":"https:\/\/jirak.net\/wp\/new-and-old-ways-to-emulate-check-constraints-domain\/","title":{"rendered":"New and old ways to emulate CHECK constraints, DOMAIN"},"content":{"rendered":"<p>Correctness of data comes in different forms. One is referential integrity, also known as <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/create-table-foreign-keys.html\">foreign keys<\/a>. Another is CHECK constraints. While MySQL supports foreign keys, <a href=\"http:\/\/bugs.mysql.com\/bug.php?id=3464\">it doesn&#8217;t support CHECK constraints<\/a>. Today we will look at three ways to emulate them:<\/p>\n<ul>\n<li>triggers<\/li>\n<li>views<\/li>\n<li><strong>generated columns (new in MySQL 5.7)<\/strong><\/li>\n<\/ul>\n<p>This is also relevant to another SQL feature: DOMAIN, which, in short, is a user-defined type composed of a base type (INT, CHAR, &#8230;), a default value, and a constraint on acceptable values &#8211; the latter being some simple sort of CHECK constraint.&hellip;<\/p>\n<p>Source: mysqlserverteam.com<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Correctness of data comes in different forms. One is referential integrity, also known as foreign keys. Another is CHECK constraints. While MySQL supports foreign keys, it doesn&#8217;t support CHECK constraints. Today we will look at three ways to emulate them: triggers views generated columns (new in MySQL 5.7) This is also relevant to another SQL feature: DOMAIN, which, in short, is a user-defined type composed of a base type (INT, CHAR, &#8230;), a default value, and a constraint on acceptable values &#8211; the latter being some simple sort of CHECK constraint.&hellip; Source: mysqlserverteam.com<\/p>\n<\/div>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[169],"tags":[498],"class_list":["post-3363","post","type-post","status-publish","format-standard","hentry","category-news","tag-mysql"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/posts\/3363","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/comments?post=3363"}],"version-history":[{"count":0,"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/posts\/3363\/revisions"}],"wp:attachment":[{"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/media?parent=3363"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/categories?post=3363"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jirak.net\/wp\/wp-json\/wp\/v2\/tags?post=3363"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}