{"id":556,"date":"2018-05-28T03:42:09","date_gmt":"2018-05-28T03:42:09","guid":{"rendered":"http:\/\/www.codeinsightacademy.com\/blog\/?page_id=556"},"modified":"2026-01-21T10:40:16","modified_gmt":"2026-01-21T10:40:16","slug":"sql","status":"publish","type":"page","link":"https:\/\/codeinsightacademy.com\/blog\/sql\/","title":{"rendered":"SQL"},"content":{"rendered":"<ul>\n<li><strong>DDL (Data Definition Language)<\/strong>\n<ul>\n<li>CREATE<\/li>\n<li>ALTER<\/li>\n<li>DROP<\/li>\n<li>TRUNCATE<\/li>\n<li>RENAME<\/li>\n<li>COMMENT<\/li>\n<\/ul>\n<\/li>\n<li><strong>DML (Data Manipulation Language)<\/strong>\n<ul>\n<li>INSERT<\/li>\n<li>UPDATE<\/li>\n<li>DELETE<\/li>\n<\/ul>\n<\/li>\n<li><strong>DQL (Data Query Language)\u00a0<\/strong>\n<ul>\n<li>SELECT\n<ul>\n<li>*<\/li>\n<li>FROM<\/li>\n<li>COLUMN<\/li>\n<li>ALIAS<\/li>\n<li>DISTINCT<\/li>\n<li>WHERE<\/li>\n<li>AND OR IN<\/li>\n<li>WILD Card Characters % and _<\/li>\n<li>LIMIT<\/li>\n<li>SUB SQL<\/li>\n<li>ORDER BY<\/li>\n<li>COUNT SUM AVG MAX MIN<\/li>\n<li>GROUP BY<\/li>\n<li>HAVING<\/li>\n<li>JOINS\n<ul>\n<li>INNER<\/li>\n<li>LEFT<\/li>\n<li>RIGHT<\/li>\n<li>FULL<\/li>\n<\/ul>\n<\/li>\n<li>UNION<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li><strong>TCL (Transaction Control Language)<\/strong>\n<ul>\n<li>COMMIT<\/li>\n<li>ROLLBACK<\/li>\n<\/ul>\n<\/li>\n<li><strong>Database Objects \/ Advanced SQL<\/strong>\n<ul>\n<li>Triggers<\/li>\n<li>Events<\/li>\n<\/ul>\n<\/li>\n<li><strong>BACKUP &amp; RESTORE<\/strong>\n<ul>\n<li>mysqldump -u user -p database [table] &gt; backup.sql<\/li>\n<li>mysql -u user -p database &lt; backup.sql<\/li>\n<\/ul>\n<\/li>\n<li><strong>DCL (Data Control Language) &#8211; Optional<\/strong>\n<ul>\n<li>GRANT<\/li>\n<li>REVOKE<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<hr \/>\n<p><strong>SQL Query Types<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/select.php\">SELECT Statement<\/a><\/td>\n<td>Retrieve records from a table<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/select_limit.php\">SELECT LIMIT Statement<\/a><\/td>\n<td>Retrieve records from a table and limit results<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/select_top.php\">SELECT TOP Statement<\/a><\/td>\n<td>Retrieve records from a table and limit results<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/insert.php\">INSERT Statement<\/a><\/td>\n<td>Insert records into a table<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/update.php\">UPDATE Statement<\/a><\/td>\n<td>Update records in a table<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/delete.php\">DELETE Statement<\/a><\/td>\n<td>Delete records from a table<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/truncate.php\">TRUNCATE TABLE Statement<\/a><\/td>\n<td>Delete all records from a table (no rollback)<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/union.php\">UNION Operator<\/a><\/td>\n<td>Combine 2 result sets (removes duplicates)<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/union_all.php\">UNION ALL Operator<\/a><\/td>\n<td>Combine 2 result sets (includes duplicates)<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/intersect.php\">INTERSECT Operator<\/a><\/td>\n<td>Intersection of 2 result sets<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/minus.php\">MINUS Operator<\/a><\/td>\n<td>Result set of one minus the result set of another<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/except.php\">EXCEPT Operator<\/a><\/td>\n<td>Result set of one minus the result set of another<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>SQL Comparison Operators<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/comparison_operators.php\">Comparison Operators<\/a><\/td>\n<td>Operators such as =, &lt;&gt;, !=, &gt;, &lt;, and so on<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>SQL Joins<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/joins.php\">JOIN Tables<\/a><\/td>\n<td>Inner and Outer joins<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>SQL Aliases<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/alias.php\">ALIASES<\/a><\/td>\n<td>Create a temporary name for a column or table<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>SQL Clauses<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/distinct.php\">DISTINCT Clause<\/a><\/td>\n<td>Retrieve unique records<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/from.php\">FROM Clause<\/a><\/td>\n<td>List tables and join information<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/where.php\">WHERE Clause<\/a><\/td>\n<td>Filter results<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/order_by.php\">ORDER BY Clause<\/a><\/td>\n<td>Sort query results<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/group_by.php\">GROUP BY Clause<\/a><\/td>\n<td>Group by one or more columns<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/having.php\">HAVING Clause<\/a><\/td>\n<td>Restrict the groups of returned rows<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>SQL Functions<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/count.php\">COUNT Function<\/a><\/td>\n<td>Return the count of an expression<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/sum.php\">SUM Function<\/a><\/td>\n<td>Return the sum of an expression<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/min.php\">MIN Function<\/a><\/td>\n<td>Return the min of an expression<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/max.php\">MAX Function<\/a><\/td>\n<td>Return the max of an expression<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/avg.php\">AVG Function<\/a><\/td>\n<td>Return the average of an expression<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>SQL Conditions<\/strong><\/p>\n<table width=\"0\">\n<tbody>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/and.php\">AND Condition<\/a><\/td>\n<td>2 or more conditions to be met<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/or.php\">OR Condition<\/a><\/td>\n<td>Any one of the conditions are met<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/and_or.php\">AND &amp; OR<\/a><\/td>\n<td>Combining AND and OR conditions<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/like.php\">LIKE Condition<\/a><\/td>\n<td>Use wildcards in a WHERE clause<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/in.php\">IN Condition<\/a><\/td>\n<td>Alternative to multiple OR conditions<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/not.php\">NOT Condition<\/a><\/td>\n<td>Negate a condition<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/is_null.php\">IS NULL Condition<\/a><\/td>\n<td>Test for NULL value<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/is_not_null.php\">IS NOT NULL Condition<\/a><\/td>\n<td>Test for NOT NULL value<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/between.php\">BETWEEN Condition<\/a><\/td>\n<td>Retrieve within a range (inclusive)<\/td>\n<\/tr>\n<tr>\n<td width=\"220\"><a href=\"https:\/\/www.techonthenet.com\/sql\/exists.php\">EXISTS Condition<\/a><\/td>\n<td>Condition is met if subquery returns at least one row<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>DDL (Data Definition Language) CREATE ALTER DROP TRUNCATE RENAME COMMENT DML (Data Manipulation Language) INSERT UPDATE DELETE DQL (Data Query Language)\u00a0 SELECT * FROM COLUMN ALIAS DISTINCT WHERE AND OR IN WILD Card Characters % and _ LIMIT SUB SQL ORDER BY COUNT SUM AVG MAX MIN GROUP BY HAVING JOINS INNER LEFT RIGHT FULL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":6,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/556"}],"collection":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/comments?post=556"}],"version-history":[{"count":12,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/556\/revisions"}],"predecessor-version":[{"id":2937,"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/pages\/556\/revisions\/2937"}],"wp:attachment":[{"href":"https:\/\/codeinsightacademy.com\/blog\/wp-json\/wp\/v2\/media?parent=556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}