vijay.edella
BAN USERWHERE is a condition on individual rows just like noraml select .....from.
HAVING clause introduces a condition on aggregations(results from the group by ... clause )i.e. results of selection where a single result, such as count, average, min, max, or sum, has been produced from multiple rows.
ex:
query to get employees whose salary is grater than 10000.
select empno,ename from emp where sal>10000;
query to get count of duplicate employees(based on empno)
select empno,count(*) from emp group by empno having count(*)>1
SELECT
avg(table1.price),
table2.zipcode
FROM
table1,
table2
WHERE
table1.transaction_id = table2.transaction_id
GROUP BY table2.zipcode
Having avg(table1.price)>5;
public class PrintStars {
public static void main(String[] args) {
int i,j,n;
n = Integer.parseInt(args[0]);//no of rows to print
for(i=0;i<n;i++){
for(j=0;j<=i;j++){
System.out.print("*");
}
System.out.println("");
}
}
}
delete from Employee
where rowid not in (
select min(rowid) from Employee group by Emp_id
)
select Name as winner from candidate
where id = (
select CandidateId from vote group by CandidateId order by count(CandidateId) desc limit 1)
for(i in 0..n-1)
for(j in 0..n-1)
b[i][j]=a[j][i]
I will write a simple logic to insert a node at beginning of linked list.
first define a structure (define globally)to create a node, as you know that node contains two parts one is data part and another one is link part (to store next node address).
define a head node globally to store first node address in linked list.
In main function intialize head node to NULL.
Now create a node(called temp) to add element at beginning
Above instruction works for when element is not present in the list and also when any number of elements are present in the list.Because in main function we intialized head to NULL;
- vijay.edella August 26, 2014