Sunday, February 12, 2012

DataBase basics

1) Whenever an aggregate function is used with other field in query, a GROUP BY clause is required
     select name, avg(price) from products GROUP BY name

      if the aggregate function is used by itself then GROUP BY is not required
     select name from products

2) Select * from tables that are joined will give columns from both tables

3) Invalid use of aggregate function

SELECT *
  FROM DEPARTMENTS WHERE BUDGET > AVG(BUDGET)

Correct use is

SELECT *
  FROM DEPARTMENTS WHERE BUDGET > (SELECT AVG(BUDGET) FROM DEPARTMENTS)


1)Heap
2)Mergesort
3)quicksort
4)b tree
5)external sort
6)BFS
7)DFS
8)Hashing - file storage

No comments:

Post a Comment