Cbse Ip More On SQL Grouping Records and Table Joins
This document discusses SQL functions for grouping records and joining tables. It provides examples of single row functions that return results for each row, and multiple row functions that aggregate data across rows. The examples demonstrate counting, minimum, maximum, average and sum functions. Table joins are also discussed, noting that a Cartesian product joins tables without conditions. Sample tables are provided and SQL queries run on them with explanations of the output.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0%(1)0% found this document useful (1 vote)
776 views2 pages
Cbse Ip More On SQL Grouping Records and Table Joins
This document discusses SQL functions for grouping records and joining tables. It provides examples of single row functions that return results for each row, and multiple row functions that aggregate data across rows. The examples demonstrate counting, minimum, maximum, average and sum functions. Table joins are also discussed, noting that a Cartesian product joins tables without conditions. Sample tables are provided and SQL queries run on them with explanations of the output.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2
MORE ON SQL GROUPING RECORDS AND TABLE JOINS
Type A: Very Short Answer Questions
1 Ans. 2 Ans. 3 Ans. 4 Ans.
What are single row functions?
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. What are multiple row functions? Multiple row functions work with data of multiple rows at a time and return aggregated value. What will be the output of following code? mysql> SELECT COUNT (Inform, atics); Output of above code will be ERROR What is Cartesian product? How is it related to join? 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:
Ans.
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; (i) 4 (ii) 34 (iii) 1100 (iv) 9800 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
Ans.
(ii) SELECT SUM(Stipend) FROM Student WHERE Grade=B;
(iii) SELECT AVG(Stipend) FROM Student WHERE Class=12A; (iv) SELECT COUNT(DISTINCT) FROM Student; (i) 64.4 (ii) 1150 (iii)