SQL Comments: The Complete Guide

Adding Comments in SQL queries is a thoughtful idea because it is used to explain the sections of SQL statements or prevent the execution of SQL statements. Comments are not supported in the Microsoft Access database. Mozilla Firefox and Microsoft Edge use the Microsoft Access database in our examples. How to Comment SQL Statements To … Read more

SQL Group By: The Complete Guide

GROUP BY in SQL is also used with the aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result by one or more columns. Its main work is to summarize the data from the database. The Group By statement allows you to arrange the rows of a query in the groups. The groups are … Read more

SQL Having Clause: The Complete Guide

The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions. The HAVING applies to the summarized group records, whereas WHERE applies to the individual records. SQL Having Clause SQL HAVING filters the records that work on summarized GROUP BY results. SQL HAVING clause combined with a GROUP … Read more

SQL UNION Operator: The Complete Guide

SQL UNION operator combines a result set of two or more SELECT statements.  SQL UNION A UNION operator in SQL combines a result-set of two or more SELECT statements. The UNION operator removes the duplicate rows between the several SELECT statements. Each SELECT statement within a UNION must have the same number of columns. It … Read more

SQL JOIN: The Complete Guide

SQL is the special-purpose programming language for managing information in the relational database management system (RDBMS). The word relational is key; it specifies that the DBMS is organized to define clear relations between the different data sets.  SQL JOIN SQL JOIN combines the records from two or more tables in a database. An SQL JOIN clause … Read more

SQL SELF JOIN: The Complete Guide

The self-join allows you to join the table to itself. It helps query the hierarchical data or compare rows within the same table. SQL Self Join Self-join in SQL is used to join the table itself means that each table row is combined with itself and with every other table row. SQL Self Join is … Read more

SQL OUTER JOIN: The Complete Guide

If you are new to this SQL blog, I have previously described Cross Join, Inner Join, and Left Join. In the SQL outer JOIN, both tables’ content is integrated whether they are matched or not. When performing the inner join, rows from either table unmatched in the other table are not returned in the final result … Read more

SQL CROSS JOIN: The Complete Guide

Cross join is also called a Cartesian product. Unlike an INNER JOIN or LEFT JOIN, the cross join does not establish the relationship between the joined tables. Each row from the first table is combined with each row from the second table, known as Cartesian join or cross join. SQL CROSS JOIN SQL CROSS JOIN … Read more

SQL BETWEEN AND IN OPERATORS: Complete Guide

SQL BETWEEN operator is almost like the SQL IN operators used sequentially. SQL BETWEEN AND IN OPERATORS SQL BETWEEN Operator is used with a WHERE clause for providing the range of values. The values can be numeric, text values, and dates. The BETWEEN operator is inclusive: begin and end values are included. SQL between operator is used … Read more

SQL Right Join: The Complete Guide

RIGHT JOIN performs a join starting with the second (right-most) table and then any matching first (left-most) table records. RIGHT JOIN and RIGHT OUTER JOIN are the same. SQL Right Join SQL RIGHT JOIN returns all the records from the right table (table2) and the matched records from the left table (table1). The result is … Read more

SQL LEFT OUTER JOIN: The Complete Guide

SQL LEFT JOIN clause allows us to query data from multiple tables. This means that the left join returns all the values from a left table, plus matched values from a right table or NULL in the case of no matching join predicate. In some SQL databases, LEFT OUTER JOIN is also called LEFT JOIN. … Read more