Simple Queries in SQL Class 11 Computer science
Simple Queries in SQL Class 11 Computer science
Answer: -
Q2= write a query to display details of employees who are not getting
commission from table Empl.
Answer =
Q3= Write a query to display employee name and salary of those employee
who don't have there salary in the range of 2500 to 4000.
Answer :-
Q4 = Write a query to display the name, job title and salary of employee who
do not have manager.
Answer :-
Q5= Write a query to display the name of employee whose name contains
'A' as third alphabet.
Answer =
Answer =
Q7= Write a query to display the name of employee whose name contains
'M' as first alphabet 'L' as third alphabet.
Answer =
Q8 = Write a query on the customers table whose output will exclude all
customers with a rating <= 100, unless they are located in Shimla.
Q9 = Write a query that selects all orders (Order table) except those with
zeros or NULLS in the amt field.
Answer =
Q 10 =Write SQL commands for the following on the basis of given table
STUDENT:
1= Display the names of the students who are getting a grade 'C' in either
GAME or SUPW.
3 = Display the SUPW taken up by the students, whose name starts with 'A'.
Answer:-
(1)
(2)
(3)
Q12= Write SQL commands for the following on the basis of given table
CLUB :
(a) To show all information about the swimming coaches in the club.
(b) To list names of all coaches with their date of appointment (DATOFAPP) in
descending order.
(c) To display a report, showing coachname, pay, age and bonus (15% of
pay) for all the coaches.
Answer =
(c). Select coachname , pay , age , pay * 0.15 as bonus from Club ;
Answer :-
(i)
COUNT
(DISTINCT
SPORTS)
4
(ii)
MIN(Age)
34
(iii)
AVG(Pay)
1100
(iv)
SUM(Pay)
7800
Q14= Write SQL commands for the following on the basis of given table
STUDENT1 :
(b) List the names of those students who are in class 12 sorted by Stipend.
(d) Display a report, listing Name, Stipend, Stream and amount of stipend
received in a year assuming that the Stipend is paid every month.
Answer =
order by stipend ;
Answer :-
(i)
MIN(AvgMark
64.4
(ii)
SUM(Stipend)
1150
(iii)
AVG(Stipend)
475.0
(iv)
It will give an error.
Q16 = Write SQL commands for the following on the basis of given table :
(a) Select all the PROG type published by BPB from Library.
(b) Display a list of all books with Price more then 130 and sorted by Qty.
(c) Display all the books sorted by Price in ascending order.
6
Answer =
Order by Qty;
Order by price ;
Q17. Write SQL commands for the following on the basis of given table MOV :
(a) Display a list of all movies with Price over 20 and sorted by Price.
(b) Display all the movies sorted by QTY in decreasing order.
(c) Display a report listing a movie number, current value and replacement
value for each movie in the above table. Calculate the replacement value for
all movies as QTY * Price * 1.15 .
Answer =
Order by price ;
(c) Select no, price, qty* price * 1.15 as replacement_value from MOV ;
Q18 = Write SQL commands for the following on the basis of given table
GRADUATE :
(a) List the names of those students who have obtained Rank 1 sorted by
NAME.
(b) Display a report, listing NAME, STIPEND, SUBJECT and amount of stipend
received in a year assuming that the STIPEND is paid every month.
Answer =
Where Rank = 1
Order by NAME ;
Q19= Write SQL commands for the following on the basis of given table
relation Teacher:
(b) To list the names of female teachers who are in Hindi department .
(c) To list names of all teachers with their date of joining in ascending order.
8
Answer =
Order by dateofjoin ;
Q20= Given the following table :Give the output of following SQL statement :
Answer
i = error
ii =
Round(AvgMark
79
73
75
iii =
Concat (Name,Stream)
RubinaNonmedical
VikasNonmedical
iv =
RIGHT(Stream,2)
al
ce
ce
es
al
9
al
es
al
al
ce