{"id":1804,"date":"2016-09-27T10:32:42","date_gmt":"2016-09-27T10:32:42","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1804"},"modified":"2016-09-27T10:32:42","modified_gmt":"2016-09-27T10:32:42","slug":"sql-queries-for-interview","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/sql-queries-for-interview\/","title":{"rendered":"SQL Queries for Interview"},"content":{"rendered":"<p><strong>What is the simplest SQL Query to find the second largest value?<\/strong><\/p>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT MAX(col)\r\n  FROM table\r\n WHERE col &lt; (SELECT MAX(col)\r\n                FROM table)\r\n<\/pre>\n<pre class=\"brush: sql; title: ; notranslate\" title=\"\">\r\nSELECT MAX(col) \r\n  FROM table \r\n WHERE col NOT IN (SELECT MAX(col) FROM table);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>What is the simplest SQL Query to find the second largest value? SELECT MAX(col) FROM table WHERE col &lt; (SELECT MAX(col) FROM table) SELECT MAX(col) FROM table WHERE col NOT IN (SELECT MAX(col) FROM table);<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[20],"tags":[],"class_list":["post-1804","post","type-post","status-publish","format-standard","hentry","category-queries"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1804","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1804"}],"version-history":[{"count":1,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1804\/revisions"}],"predecessor-version":[{"id":1805,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1804\/revisions\/1805"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1804"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1804"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1804"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}