{"id":54,"date":"2007-04-16T15:39:42","date_gmt":"2007-04-16T21:39:42","guid":{"rendered":"http:\/\/thenoyes.com\/littlenoise\/?p=54"},"modified":"2007-04-16T15:39:42","modified_gmt":"2007-04-16T21:39:42","slug":"access-control-quiz","status":"publish","type":"post","link":"https:\/\/thenoyes.com\/littlenoise\/?p=54","title":{"rendered":"Access Control Quiz"},"content":{"rendered":"<p>First, the setup:<\/p>\n<pre>CREATE TABLE `user` (\r\n  `user` varchar(255) DEFAULT NULL,\r\n  `host` varchar(255) DEFAULT NULL,\r\n  `sort` int(11) DEFAULT NULL\r\n);\r\n\r\nINSERT INTO `user` \r\n    (`user`, `host`, `sort`) \r\nVALUES \r\n    ('','%',8),\r\n    ('testUser','%',7),\r\n    ('','%localhost',9),\r\n    ('testUser','%localhost',5),\r\n    ('','%localhost%',10),\r\n    ('testUser','%localhost%',6),\r\n    ('','localhost',2),\r\n    ('testUser','localhost',1),\r\n    ('','localhost%',4),\r\n    ('testUser','localhost%',3);<\/pre>\n<p>Now, the quiz:<\/p>\n<pre>SELECT * FROM user ORDER BY ___<\/pre>\n<p>Fill in the blank to get the following output. Difficulty: the `sort` field may not appear anywhere in the query.<\/p>\n<pre>+----------+-------------+------+\r\n| user     | host        | sort |\r\n+----------+-------------+------+\r\n| testUser | localhost   |    1 |\r\n|          | localhost   |    2 |\r\n| testUser | localhost%  |    3 |\r\n|          | localhost%  |    4 |\r\n| testUser | %localhost  |    5 |\r\n| testUser | %localhost% |    6 |\r\n| testUser | %           |    7 |\r\n|          | %           |    8 |\r\n|          | %localhost  |    9 |\r\n|          | %localhost% |   10 |\r\n+----------+-------------+------+<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>First, the setup: CREATE TABLE `user` ( `user` varchar(255) DEFAULT NULL, `host` varchar(255) DEFAULT NULL, `sort` int(11) DEFAULT NULL ); INSERT INTO `user` (`user`, `host`, `sort`) VALUES (&#8221;,&#8217;%&#8217;,8), (&#8216;testUser&#8217;,&#8217;%&#8217;,7), (&#8221;,&#8217;%localhost&#8217;,9), (&#8216;testUser&#8217;,&#8217;%localhost&#8217;,5), (&#8221;,&#8217;%localhost%&#8217;,10), (&#8216;testUser&#8217;,&#8217;%localhost%&#8217;,6), (&#8221;,&#8217;localhost&#8217;,2), (&#8216;testUser&#8217;,&#8217;localhost&#8217;,1), (&#8221;,&#8217;localhost%&#8217;,4), (&#8216;testUser&#8217;,&#8217;localhost%&#8217;,3); Now, the quiz: SELECT * FROM user ORDER BY ___ Fill in the blank to get the following [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6],"tags":[],"class_list":["post-54","post","type-post","status-publish","format-standard","hentry","category-gotchas"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p2IBF1-S","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/54","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54"}],"version-history":[{"count":0,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thenoyes.com\/littlenoise\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}