0% found this document useful (0 votes)
60 views7 pages

Question 1669064

Uploaded by

ravienjoy2010
Copyright
© © All Rights Reserved
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% found this document useful (0 votes)
60 views7 pages

Question 1669064

Uploaded by

ravienjoy2010
Copyright
© © All Rights Reserved
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/ 7

SRI VIJAY VIDYASHRAM SR. SEC.

SCHOOL-DPI

FIRST 25%
Class 12 - Informatics Practices
Time Allowed: 3 hours Maximum Marks: 60

Section A
1. Which clause is similar to HAVING clause in MySQL? [1]

a) SELECT b) WHERE

c) FROM d) TO
2. Which of the following is not an aggregate function? [1]

a) MAX() b) ADD()

c) COUNT() d) AVG()
3. Select correct SQL query from below to find the temperature in increasing order of all cites. [1]

a) SELECT city FROM weather ORDER BY b) SELECT city, temperature FROM weather
temperature; ORDER BY temperature;

c) SELECT city, temperature FROM weather d) SELECT city, temperature FROM weather;
ORDER BY city;
4. Consider the Club (coachid, coachname, sport, dateofapp, pay). [1]
List names of all coaches with their date of appointment in descending order.

a) Select coachname, dataofapp from club b) Select * from club order by dateofapp
order by dateofapp DSC DESC

c) Select coachname, dataofapp from club d) Select * from club order by dateofapp DSC
order by dateofapp DESC
5. What is the significance of the statement GROUP BY d.name in the following MySQL statement? [1]
SELECT name, COUNT (emp_id), emp_no FROM department GROUP BY name;

a) Aggregation of the field "name" of table b) Sorting of the field "Level"


"department"

c) Counting of the field "name" on the table d) Sorting of the field "name"
"department"
6. Which of the following would arrange the rows in ascending order in SQL. [1]

a) SORT BY b) GROUP BY

c) ALIGN BY d) ORDER BY
7. What will be the order of sorting in the following MySQL statement? [1]
SELECT emp_id, emp_name FROM person ORDER BY emp_id, emp_name;

a) Sorting {emp_id} but not emp_name b) Sorting {emp_id} but emp_name

c) Sorting {emp_id, emp_name} d) Sorting {emp_name, emp_id}

1/7
8. What is the significance of the statement "HAVING COUNT (emp_id)>2" in the following MySQL statement? [1]
SELECT name, COUNT (emp_id),emp_no FROM department GROUP BY name HAVING COUNT
(emp_id)>2;

a) Selecting those rows whose total emp_id>2 b) Both filter out all rows whose total emp_id
below 2 and selecting those rows whose
total emp_id>2

c) Filter out all rows whose total emp_id equal d) Filter out all rows whose total emp_id
to 2 below 2
9. If we have not specified ASC or DESC after a SQL ORDER BY clause, the following is used by default [1]

a) There is no default value b) There is default value

c) DESC d) ASC
10. The now() function in MySql is an example of? [1]

a) Text function b) Aggregate function

c) Math function d) Date function


11. What will be returned by the given query? [1]
SELECT month('2020-05-11');

a) 11 b) November

c) May d) 5
12. Which of the following function is used to FIND the largest value from the given data in MYSQL? [1]

a) MAX() b) LARGEST()

c) BIG() d) MAXIMUM()
13. ________ helps to fetch a group of rows based on common values in a column. [1]

a) GROUP BY b) SELECT BY

c) ORDER BY d) FILTER
14. Which of the following function is not an aggregate function? [1]
a. Round()
b. Sum()
c. Count()
d. Avg()

a) Option (a) b) Option (c)

c) Option (d) d) Option (b)


15. What will be the order of the data being sorted after the execution of given query? [1]
SELECT * FROM STUDENT ORDER BY ROLL_NO;

a) Custom Sort b) Sequential

c) Ascending d) Descending
16. What is the full form of SQL? [1]

2/7
a) Simple Query Language b) Structured Query List

c) Structured Query Language d) Simple Query List


17. Which of the following is true about the HAVING clause? [1]

a) Acts exactly like a WHERE clause. b) Similar to the WHERE clause but is used
for columns rather than groups.

c) Similar to WHERE clause but is used for d) Similar to WHERE clause but is used for
groups rather than rows. rows rather than columns.
18. Which of the following is not a valid aggregate function in MYSQL? [1]

a) MAX ( ) b) SUM ( )

c) COUNT ( ) d) LEN ( )
19. Which aggregate function returns the count of all rows in a specified table? [1]

a) SUB b) COUNT

c) SUM d) DISTINCT
20. Which clause is used with an aggregate functions? [1]

a) WHERE b) Both GROUP BY and WHERE

c) GROUP BY d) SELECT
21. Priyanka has given the following command to obtain the highest marks Select max(marks) from student where [1]
group by class; but she is not getting the desired result. Help her by writing the correct command.

a) Select class, max(marks) from student group b) Select class, max(marks) group by class
by marks; from student;

c) Select max(marks) from student where d) Select class, max(marks) from student
group by class; group by class;
22. What is the significance of ORDER BY in the following MySQL statement? [1]
SELECT emp_id, fname, Iname FROM person ORDER BY emp_id;

a) Data of emp_id will be sorted in descending b) Data of emp_id will be sorted


order

c) Data of emp_id will be sorted in ascending d) All of these


order
23. What is the meaning of HAVING clause in SELECT query. [1]

a) To filter out the row b) To filter out the column groups.

c) To filter out the summary groups. d) To filter out the row and column values.
24. For given table emp with following columns [1]
eno, ename, sal, dept, designation
Select correct statement to display all records of 'emp' in descending order of ename and within ascending order
of dept.

a) SELECT * FROM emp ORDER BY ename, b) SELECT * FROM emp WHERE ORDER
ORDER BY dept DESC; BY ename, dept DESC;

3/7
c) SELECT * FROM emp ORDER BY ename d) SELECT * FROM emp ORDER BY
DESC, dept; ename, dept DESC;
25. An aggregate function: [1]
a. Takes a column name as its arguments
b. May take an expression as its argument
c. Both takes a column name as its arguments and may take an expression as its argument
d. None of these

a) Option (a) b) Option (d)

c) Option (b) d) Option (c)


26. Which of the following are correct aggregate functions in SQL: [1]

i. AVERAGE()

ii. MAX()

iii. COUNT()

iv. TOTAL()

27. Differentiate between COUNT ( ) and COUNT (*) functions in MYSQL. Give suitable examples to support [1]
your answer.
28. Keshav has written the following query to find out the sum of bonus earned by the employees of WEST zone: [1]
SELECT zone, TOTAL (bonus) FROM employee HAVING zone = 'WEST' ;
But he got an error. Identify the errors and rewrite the query by underlining the correction(s) done.
29. Which SQL command is used to modify the existing structure of a table? [1]
30. Which command is used to display the system date? [1]
Section B
31. To display the roll number, name and marks of all the students in descending order of their marks and ascending [2]
order of their names.
32. Gopi Krishna is using a table EMPLOYEE. It has the following columns: [2]
Code, Name, Salary, Deptcode
He wants to display maximum salary departmentwise.
He wrote the following command:

SELECT Deptcode, MAX (Salary) FROM EMPLOYEE;

But he did not get desired result.


Rewrite the above query with necessary change to help him get the desired output.
33. Write the output (i and ii) for the following SQL commands: [2]
Table: F_INDIA

F_ID Product Price Qty

F01 Sun Cream 678 10

F02 Beauty Cream 5400 15

4/7
F03 Face Glow Foundation 1704 20

F04 Gel Wax 520 10

F05 Hair Shampoo 800 25

F06 Beauty Cream 1200 32

i. SELECT COUNT (Distinct product) FROM F_INDIA;


ii. SELECT Product, Price FROM F_INDIA WHERE Product LIKE '%m':
34. Write the output (i-iii) for the following SQL commands: [2]
Table : CLUB

SNo Activity Fee Days

1 Swimming 10000 M, W

2 Singing 8000 Th, S

3 Dance 12000 M, W

4 Drawing 7000 T, Th

5 Craft 8000 F, S

6 Cooking 9000 T, F

i. SELECT COUNT(*) FROM CLUB;


ii. SELECT SUM(Fee) FROM CLUB;
35. Consider the following table structure. STUDENT (RollNo, Name, Class, Stream, Percentage) Give the answer [2]
of the following questions on the basis of the above table structure
i. Write a query to display the concatenated form of name and class.
ii. Write a query to display the name whose percentage is greater than 70.
36. How are NULL values treated by aggregate functions? [2]
Section C
37. Write commands in SQL for (i) and (ii) and output for (iii) [3]

Store ld Name Location City No. of Emp Date Open Sales Amt

S101 Planet Fashion Bandra Mumbai 7 2015-10-16 40000

S102 Vogue Karol Bagh Delhi 8 2015-07-14 120000

S103 Trends Powai Mumbai 10 2015-06-24 30000

S104 Super Fashion Thane Mumbai 11 2015-02-06 45000

S105 Annabelle South Extn. Delhi 8 2015-04-09 60000

S106 Rage Defence Colony Delhi 5 2015-03-01 20000

i. To display the details of the store in alphabetical order of name.


ii. To display the City and the number of stores located in that City, only if the number of stores is more than 2.
iii. SELECT COUNT(STOREID), NOOFEMP FROM STORE GROUP BY NOOFEMP HAVING
MAX(SALESAMT)<60000;
38. Write SQL queries for (i) to (iii) and the outputs for (iv) and (v), which are based on the following table [3]

5/7
PARTICIPANTS

Table : PARTICIPANTS

PNO EVENT SNAME CLASS DOB

P1 DEBATE SANYAM 12 2001-12-25

P2 DEBATE SHRUTI 10 2003-11-10

P3 DEBATE MEHER 12 2001-11-10

P4 QUIZ SAKSHI 11 2002-10-12

P5 QUIZ RITESH 12 2001-10-12

P6 QUIZ RAHUL 10 2003-10-12

P7 CROSSWORD AMEER 11 2002-05-09

P8 CROSSWORD MINAKSHI 12 2001-05-09

i. To display details of all PARTICIPANTS of CLASS 10 and 12


ii. To display the number of PARTICIPANTS along with their respective CLASS, of every CLASS;
iii. SELECT MAX(DOB), PNO FROM PARTICIPANTS GROUP BY PNO HAVING COUNT(*)>1;
Section D
39. Based on the given table EMPLOYEE write SQL queries to perform the following operations: [4]
Table : EMPLOYEE

Ecode Ename Area Salary Dept Doj

S001 Ramesh North 12000 Sales 2015-12-01

S002 Rohit South 10500 Finance 2012-08-01

S003 Sunil South 6800 Front Office 2018-02-01

S004 Sambhav West 28000 Back Office 2010-04-01

S005 Ankit East 9000 NULL 2018-10-01

S006 Rishu North 25000 Finance 2019-02-01

a. Count the total number of employees.


b. Display the minimum salary from each area.
c. Display the average salary from each department where number of employees is more than 1.
d. Display all the records in descending order of date of joining.
40. Consider a table ITEM with the following data: [4]

S.No. Item name Type Stock date Price Discount

1 Eating Paradise Dining Table 19-02-2002 11500⋅ 58 25

2 Royal Tiger Sofa 22-02-2002 31000⋅ 67 30

3 Decent Office Table 01-01-2002 25000⋅ 623 30

4 Pink Feather Baby Cot 20-01-2001 7000⋅ 3 20

6/7
5 White Lotus Double Bed 23-02-2002 NULL 25

Write SQL queries using SQL functions to perform the following operations:
i. Display the Itemname whose price more than 10000
ii. Display the month name from the Stockdate.
iii. Display the total price of the whole stock.
iv. Display the average Price of all the stocks
41. Consider the table DOCTOR given below. Write commands in SQL for (i) to (ii) and output for (iii) to (v). [4]
Table : DOCTOR

ID DOCName Department DOJ Gender Salary

1 Amit Kumar Orthopaedics 1993-02-12 M 35000

2 Anita Hans Paediatrics 1998-10-16 F 30000

3 Sunita Maini Gynaecology 1991-08-23 F 40000

4 Joe Thomas Surgery 1994-10-20 M 55000

5 Gurpreet Kaur Paediatrics 1999-11-24 F 52000

6 Anandini Burman Oncology 1994-03-16 F 31000

7 Siddharth Dang Surgery 1995-09-08 M 47000

8 Rama Mukherjee Oncology 2000-06-27 F 54500

i. Display the names and salaries of doctors in descending order of salaries.


ii. Display names of each department alongwith total salary being given to doctors of that department.
iii. SELECT SUM (Salary) FROM DOCTOR WHERE Department = 'Surgery';
iv. SELECT DOCName FROM DOCTOR WHERE Department LIKE "%gery%";

7/7

You might also like