0% found this document useful (0 votes)
33 views

SQL2

This document contains questions about SQL statements and functions. It asks to write SQL queries to perform operations like finding highest/lowest marks by city or gender, counting records by condition, extracting substrings and performing calculations.

Uploaded by

Agastya Karnwal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

SQL2

This document contains questions about SQL statements and functions. It asks to write SQL queries to perform operations like finding highest/lowest marks by city or gender, counting records by condition, extracting substrings and performing calculations.

Uploaded by

Agastya Karnwal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

2.

Which type of values will not be considered by SQL while executing the 1
following statement?
SELECT COUNT(column name) FROM inventory; i. Numeric value ii. text
value iii. Null value iv. Date value
3. If column “Fees” contains the data set 1
(5000,8000,7500,5000,8000), what will be the output after the execution of
the given query?
SELECT SUM (DISTINCT Fees) FROM student;
i. 20500 ii. 10000 iii. 20000 iv. 33500
4. The command can be used to insert a new row in a table in SQL. 1
i. add() ii. append iii. insert into iv. alter table
6. Which SQL statement do we use to find out the total number of records 1
present in the table ORDERS?
i. SELECT * FROM ORDERS;
ii. SELECT COUNT (*) FROM ORDERS;
iii. SELECT FIND (*) FROM ORDERS;
iv. SELECT SUM () FROM ORDERS;
8. Write the output of the following SQL command. select ROUND(1567.884,1); 1
a. 1567.88 b.1567.8 c.1567.9 d. 1568
11. What will be the output of the following code? 1
mysql>> select lcase ('INFORMATICS PRACTICES CLASS 12TH');
14. With SQL, how can you return the number of rows not null value in the 2
Project field of Students table
(a) SELECT COUNT(Project) FROM STUDENTS;
(b) SELECT COLUMNS(Project) FROM STUDENTS;
(c) SELECT COLUMNS(*) FROM STUDENTS;
(d) SELECT COUNT(*) FROM STUDENTS:
Write a short explanation of your answer query.
15. What is the difference between the group by and order by clause when used 2
along with the select statement? Explain with an example.
17. Consider the following SQL string: “Computer” Write commands to display: 2
a. “mputer” b. “ut”
19. Nadar has recently shifted to a new city and school. She does not know many 3
people in her new city and school. But all of a sudden, someone is posting
negative, demeaning comments on her social networking profile etc. She is
also getting repeated mails from unknown people. Every time she goes
online, she finds someone chasing her online.
i. What is this happening to Nadar?
ii. What immediate action should she take to handle it? iii. Is there any
law in India to handle such issues? Discuss briefly

20. Based on table STUDENT given here, write suitable SQL queries for the 3
following :
Roll No Name Class Gender City Marks
1 Abhishek XI M Agra 430
2 Prateek XII M Mumbai 440
3 Sneha XI F Agra 470
4 Nancy XII F Mumbai 492
5 Himnashu XII M Delhi 360
6 Anchal XI F Dubai 256
7 Mehar X F Moscow 324
8 Nishant X M Moscow 429
i. Display gender wise highest marks.
ii. Display city wise lowest marks.
iii. Display total number of male and female students.

PART D

22. Write the SQL functions which will perform the following operations: 5
i) To display the current date .
ii) To display the substring “earn” from the whole string ‘LearningIsFun’.
iii) To round the number 76.384 up to 2 place after decimal point.
iv) To find the position of first occurrence of ‘R’ in string
'INFORMATION FORM'
v) To find out the result of 93 .
OR

Consider a table Order with the following data: Write SQL queries using SQL
functions to perform the following operations:

1. To count the number of orders booked by Salespersons with names starting


with ‘R’.
2. Display the position of occurrence of the string “an” in SalesPerson names.
3. Display the four characters from SalesPerson name starting from second
character
4. To find the average of order amount. Display the month name for the
order date
23. A relation Vehicles is given below: Write SQL commands to: 5

1. Count the type of vehicles manufactured by each company.


2. Display the total price of all the types of vehicles.
3. Display the average price of each type of vehicle having quantity more than
20.
4. Write a query to display type and price * quantity with title TOTAL PRICE
company wise.
5. Display average price for each company.

You might also like