CBSE Informatics Practices 065 class 12 term2 sample paper 2021-22
CBSE Informatics Practices 065 class 12 term2 sample paper 2021-22
Consider a table SALESMAN with the following data :
Write SQL queries using SQL functions to perform the following operations :
Q1. Display salesman name and bonus after rounding off to zero decimal places.
Ans:-
SELECT SNAME,ROUND(BONUS,0) FROM SALESMAN;
Q2. Display the position of occurrence of the string “ta” in salesman names.
Ans:-
SELECT INSTR(SNAME,”ta”) FROM SALESMAN;
Q3. Display the four characters from salesman name starting from second character.
Ans:-
SELECT SUBSTR (SNAME,2,4) FROM SALESMAN;
Q4. Display the month name for the date of join of salesman.
Ans:-
SELECT MONTHNAME(DATE_OF_JOIN) FROM SALESMAN;
Q5. Display the name of the weekday for the date of join of salesman.
Ans:-
SELECT DAYNAME(DATE_OF_JOIN) FROM SALESMAN;
Consider the table MEDICINES :
Q1. Display the medicine details those salesman are female.
Ans:-
SELECT * FROM MEDICINES WHERE SALESMAN LIKE ‘MRS%’ OR SALESMAN LIKE ‘MISS%’ ;
Q2. Display brand and total price for each brand.
Ans:-
SELECT BRAND,SUM(PRICE) FROM MEDICINES GROUP BY BRAND;
Q3. Display the medicines those have the ingredient “Amla”.
Ans:-
SELECT * FROM MEDICINES WHERE COMPOSITION LIKE ‘%AMLA%’;
Q4. Increase the price by 20 for all medicines.
Ans:-
UPDATE MEDICINES SET PRICE=PRICE+20;
Q5. Write the command to display first 3 characters from medicine name and price.
Ans:-
SELECT SUBSTR(MED_NAME,1,3),PRICE FROM MEDICINES;