Group is always associated with more than one entity with same value or interest. In MySQL, GROUP BY clause is used in similar terms to fetch records that have same value. GROUP BY clause can be used in the SELECT statement and can also be used with aggregate functions. Let us first see comman syntax for a group by query : SELECT col_names from t...

Read More

JOIN is a term used to co-relate or combine two things related to each other, similarly in MySQL when two or more tables are co-related to each other with identifiers we use JOIN clause to retrieve records from them.  There are mainly three types of MySQL joins: MySQL INNER JOIN, also known as SIMPLE JOIN. MySQL LEFT OUTER JOIN, also known as LEFT ...

Read More

It is possible to embed a SQL statement within another. When this is done on the WHERE or the HAVING statements, we have a subquery construct. What is subquery useful for ? It is used to join tables and there are cases where the only way to correlate two tables is through a subquery. SELECT emp.firstname, emp.surname FROM employees emp WHERE emp....

Read More

Both primary key and unique key enforce uniqueness of the column on which they are defined. But by default Primary key creates a clustered index on the column. Unique creates a non-clustered index by default. Another major difference is that: Primary key doesnot allow NULLs. Unique key allows one NULL only. What is the best practice relating to pri...

Read More

FOLLOW US ON LinkedIn



Explore Tutu'rself