In: Computer Science
describe what these mysql queries do
1.)
select lastname, firstname, region, birthday
from Members
where birthday in (select birthday
from Members
where email is not null)
2.)
select Sales.Firstname As EmpFirst, Sales.Lastname as EmpLast,
Sup.Firstname as SupFirst, Sup.Lastname as SupLast
from Salespeople Sales inner join Salespeople Sup
On Sales.Supervisor=Sup.SalesID
3.)
select Region, Gender, Count(*) As Num
from Members
where Email is null group by region, gender
4.)
select title
from titles
where not Genre = 'Jazz';
Query 1:
In this query firstly inner query run and select all the birthday from member table where email id is not null. After that outer query is run and print lastname,firstname,region, bithday from member table where bithday are matching with inner query output.
Query 2:
this query consist of inner join in Salespeople table on supervisor and salesId column.
this query two alies name are creaed of the same table first is sales and second is sup.
So when condition Sales.Supervisor=Sup.SalesID is matched, then
it print sales first name as EmpFirst and Sales Lastname as EmpLast and sup first name as SupFirst and Sup Lastname as SupLast.
Query 3:
In this query, it group all the region and gender where email id is null and then print region ,gender with their count.( same region and gender are group together).
Query 4:
In this query,
it select all the title from titles table where Genre not equals to 'Jazz'