Informatics Practices Class 12 SQL
Informatics Practices Class 12 SQL
Question 2.
There is a column Salary in a Table EMPLOYEE. The following two statements are giving
different outputs. What may be the possible reason? (Delhi2013)
SELECT COUNT(Salary)
FROM EMPLOYEE;
This statement returns the number of values (NULL values will not be counted) of the
specified column.
Question 3.
A table FLIGHT has 4 rows and 2 columns and another table AIRHOSTESS has rows and 4
columns. How
many rows and columns will be there if we obtain the cartesian product of these two
tables? (Delhi 2012)
Answer:
Total number of rows will be 12 and total number of columns will be 6.
Question 4.
What is the purpose of GROUP BY clause in MySQL? How is it different from ORDER BY
clause? (Delhi 2012; All India 2012)
Answer:
The GROUP BY clause can be used to combine all those records that have identical value
in a particular field or a group of fields. Whereas, ORDER BY clause is used to display the
records either in ascending or descending order based on a particular field. For ascending
order ASC is used and for descending order, DESC is used. The default order is ascending
order.
Question 5.
Shanya Khanna is using a table EMPLOYEE. It has the following columns:
Question 6.
Consider the following table named SBOP with details of account holders. Write
commands of MySql for (i) to (iv) and output for (v) to (vii).
TABLE SBOP
(i) To display Accountno, Name and DateOfopen of account holders having transactions
more than 8.
(ii) To display all information of account holders whose transaction value is not
mentioned.
(iii) To add another column Address with datatype and size as VARCHAR(25).
(iv) To display the month day with reference to DateOfopen for all the account holders.
(Delhi2014)
(v) SELECT COUNT (*) FROM SBOP;
(vi) SELECT Name, Balance FROM SBOP WHERE Name LIKE “%i”;
(vii) SELECT ROUND (Balance,-3) FROM SBOP
WHERE Accountno="SB-5” ;
Answer: