Basics Employee Empid Name courseid 1 Sandeep 10 2 Deepak 20 3 Dharmu Course id courseName duration 10 mysql 1.5 20 java programming 2 30 String programming 1 Inner Join or Simply Join : select * from Employee JOIN Course ON Employee.courseid = Course.id; Output: this will first internally do Cartesian product from each row of left table to each row in right table, then applies the filter , to match row, which has same courseid and id. So this will be the output, next all joins will add few more rows on this output. Empid Name courseid id cou...
Group by <SameColumn>, this basically group the rows having same column value. lets say, --> Group by department, this this will club all the rows which has same department, and it will have some sort of list of list, 1st position, list of 6 rows, from CSE department 2nd row, list of 2 rows from ECE department Now in these rows, you can only perform some aggregate funtion and display it, you can display employee name of department as output, because one collection, say 1st position, may have 6 rows each having different employee name, what it will display? i.e. you should/can perfrom only agregate function on this grouped by list. select count(CustomerID) as countryhead,country,city from customers group by Country,city order by countryhead DESC; countryhead Country City 6 UK London 5 Mexico México D.F. 4 Brazil São Paulo 3 Argentina Buenos Aires 3 Brazil Rio de Janeiro 3 Spain Madrid
Comments
Post a Comment