Você está na página 1de 2

MORE ON SQL – GROUPING RECORDS AND TABLE JOINS

Type A: Very Short Answer Questions


1 What are single row functions?
Ans. Single row functions work with a single row at a time. A single row function returns a result for every row of a
queried table.
2 What are multiple row functions?
Ans. Multiple row functions work with data of multiple rows at a time and return aggregated value.
3 What will be the output of following code?
mysql> SELECT COUNT (‘Inform’, ‘atics’);
Ans. Output of above code will be ‘ERROR’
4 What is Cartesian product? How is it related to join?
Ans. Joining two or more tables without any condition, it is called Cartesian product or Unrestricted Join.
TYPE B: Short Answer Questions
1 Given the following table:

Give the output of following SQL statements:


(i) SELECT COUNT (DISTINCT SPORTS) FROM Club;
(ii) SELECT MIN(Age) FROM CLUB WHERE Sex=’F’;
(iii) SELECT AVG(Pay) FROM CLUB WHERE Sports = ‘KARATE’;
(iv) SELECT SUM(Pay) FROM CLUB WHERE Datofapp > ‘31/01/98’;
Ans. (i) 4
(ii) 34
(iii) 1100
(iv) 9800
2 Given the following table:
TABLE: STUDENT

Give the output of following SQL statements:


(i) SELECT MIN(AvgMark) FROM STUDENT WHERE AvgMark<75;

Page 1 of 2
(ii) SELECT SUM(Stipend) FROM Student WHERE Grade=’B’;
(iii) SELECT AVG(Stipend) FROM Student WHERE Class=’12A’;
(iv) SELECT COUNT(DISTINCT) FROM Student;
Ans. (i) 64.4
(ii) 1150
(iii)

Page 2 of 2

Você também pode gostar