{"id":1498,"date":"2022-01-20T11:05:43","date_gmt":"2022-01-20T11:05:43","guid":{"rendered":"https:\/\/blog.amt.in\/?p=1498"},"modified":"2022-01-20T11:05:43","modified_gmt":"2022-01-20T11:05:43","slug":"introduction-to-sql","status":"publish","type":"post","link":"https:\/\/blog.amt.in\/index.php\/2022\/01\/20\/introduction-to-sql\/","title":{"rendered":"Introduction to SQL"},"content":{"rendered":"<p>SQL\u00c2\u00a0(Structured Query Language)\u00c2\u00a0is a\u00c2\u00a0domain-specific language\u00c2\u00a0used in programming and designed for managing data held in a\u00c2\u00a0relational database management system\u00c2\u00a0(RDBMS), or for stream processing in a\u00c2\u00a0relational data stream management system\u00c2\u00a0(RDSMS). It is particularly useful in handling\u00c2\u00a0structured data\u00c2\u00a0where there are relations between different entities\/variables of the data. SQL offers two main advantages over older read\/write\u00c2\u00a0APIs\u00c2\u00a0like\u00c2\u00a0ISAM\u00c2\u00a0or\u00c2\u00a0VSAM: first, it introduced the concept of accessing many records with one single command; and second, it eliminates the need to specify\u00c2\u00a0<i>how<\/i>\u00c2\u00a0to reach a record, e.g. with or without an\u00c2\u00a0index.<\/p>\n<p>Originally based upon\u00c2\u00a0relational algebra\u00c2\u00a0and\u00c2\u00a0tuple relational calculus, SQL consists of many types of statements,\u00c2\u00a0which may be informally classed as\u00c2\u00a0sub-languages, commonly: a\u00c2\u00a0data query language\u00c2\u00a0(DQL),\u00c2\u00a0a\u00c2\u00a0data definition language\u00c2\u00a0(DDL),\u00c2\u00a0a\u00c2\u00a0data control language\u00c2\u00a0(DCL), and a\u00c2\u00a0data manipulation language\u00c2\u00a0(DML).\u00c2\u00a0The scope of SQL includes data query, data manipulation (insert, update and delete), data definition (schema\u00c2\u00a0creation and modification), and data access control. Although SQL is often described as, and to a great extent is, a\u00c2\u00a0declarative language\u00c2\u00a0(4GL), it also includes\u00c2\u00a0procedural\u00c2\u00a0elements.<\/p>\n<p>SQL was one of the first commercial languages for\u00c2\u00a0Edgar F. Codd&#8217;s\u00c2\u00a0relational model, as described in his influential 1970 paper, &#8220;A Relational Model of Data for Large Shared Data Banks&#8221;.\u00c2\u00a0Despite not entirely adhering to\u00c2\u00a0the relational model as described by Codd, it became the most widely used database language.<\/p>\n<p>SQL became a\u00c2\u00a0standard\u00c2\u00a0of the\u00c2\u00a0American National Standards Institute\u00c2\u00a0(ANSI) in 1986, and of the\u00c2\u00a0International Organization for Standardization\u00c2\u00a0(ISO) in 1987.\u00c2\u00a0Since then, the standard has been revised to include a larger set of features. Despite the existence of such standards, most SQL code is not completely portable among different database systems without adjustments.<\/p>\n<p>SQL deviates in several ways from its theoretical foundation, the\u00c2\u00a0relational model\u00c2\u00a0and its\u00c2\u00a0tuple calculus. In that model, a table is a\u00c2\u00a0set\u00c2\u00a0of tuples, while in SQL, tables and query results are\u00c2\u00a0lists\u00c2\u00a0of rows: the same row may occur multiple times, and the order of rows can be employed in queries (e.g. in the LIMIT clause).<\/p>\n<p>The SQL language is subdivided into several language elements, including:<\/p>\n<ul>\n<li>Clauses, which are constituent components of statements and queries. (In some cases, these are optional.)<\/li>\n<li>Expressions, which can produce either\u00c2\u00a0scalar\u00c2\u00a0values, or\u00c2\u00a0tables\u00c2\u00a0consisting of\u00c2\u00a0columns\u00c2\u00a0and\u00c2\u00a0rows\u00c2\u00a0of data<\/li>\n<li>Predicates, which specify conditions that can be evaluated to SQL\u00c2\u00a0three-valued logic (3VL)(true\/false\/unknown) or\u00c2\u00a0Boolean\u00c2\u00a0truth values\u00c2\u00a0and are used to limit the effects of statements and queries, or to change program flow.<\/li>\n<li>Queries, which retrieve the data based on specific criteria. This is an important element of\u00c2\u00a0<i>SQL<\/i>.<\/li>\n<li>Statements, which may have a persistent effect on schemata and data, or may control\u00c2\u00a0transactions, program flow, connections, sessions, or diagnostics.<\/li>\n<li>SQL statements also include the\u00c2\u00a0semicolon\u00c2\u00a0(&#8220;;&#8221;) statement terminator. Though not required on every platform, it is defined as a standard part of the SQL grammar.<\/li>\n<li>Insignificant white-space\u00c2\u00a0is generally ignored in SQL statements and queries, making it easier to format SQL code for readability.<\/li>\n<\/ul>\n<p>The above is a brief about SQL. Watch this space for more updates on the latest trends in Technology.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SQL\u00c2\u00a0(Structured Query Language)\u00c2\u00a0is a\u00c2\u00a0domain-specific language\u00c2\u00a0used<\/p>\n","protected":false},"author":1,"featured_media":1500,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[219,220,7],"tags":[221,222,18],"class_list":["post-1498","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sql","category-structured-query-language","category-techtrends","tag-sql","tag-structured-query-language","tag-technology"],"_links":{"self":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/comments?post=1498"}],"version-history":[{"count":1,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1498\/revisions"}],"predecessor-version":[{"id":1499,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/posts\/1498\/revisions\/1499"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media\/1500"}],"wp:attachment":[{"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/media?parent=1498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/categories?post=1498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.amt.in\/index.php\/wp-json\/wp\/v2\/tags?post=1498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}