Holidays HW IP XII Page 3
Holidays HW IP XII Page 3
CLASS: XII
WORKSHEET
1. What is the purpose of DROP TABLE command in SOL? How is it different from DELETE command?
Write the command To increase the Price of all the Products by 20.
3. Write the UPDATE command to change “Sharma” to “Singh” in the “LastName” column in the Employee
table.
4. What is the use of UPDATE statement in SQL ? How is it different from ALTER statement?
Write command To change the Brandname to "Fit Trend India" of the item, whose ICODE as "G101 ".
6. Write the UPDATE statement in MySQL to increase commission by 100.00 in the ‘‘Commission’’ column
in the ‘Emp’ table.
8. In a database there are two tables ‘CD’ and ‘TYPE’ as shown below :
Write SQL statement to change the name of Singer ‘‘Sonvi Kumar’’ to ‘‘Sonvi Mehra’’ in all the places
wherever it occurs in CD table.
1) Write command To change the colour of garment with code as 116 to “Orange”.
2) Write command to increase the price of all XL garments by 10%
3) Write command to delete the record with GCode “116”
Write SQL command to change the JOBID to 104 of the Employee with ID as E4 in the table ‘EMPLOYEE’.
11. In Marks column of ‘Student’ table, for Rollnumber 2, the Class Teacher entered the marks as 45.
However there was a totaling error and the student has got her marks increased by 5. Which MySQL
command should she use to change the marks in ‘Student’ table.
12. Chhavi has created a table named Orders, she has been asked to increase the value of a column named
salesamount by 20. She has written the following query for the same.
Alter table Orders Add salesamount =salesamount+20;
Is it the correct query?Justify.
16. State difference between date functions NOW( ) and SYSDATE( ) of MySql.
17. Name a function of MySql which is used to remove trailing and leading spaces from a string.
29. Consider the table TEACHER given below. Write commands in SQL for (1) and output for (2) to (5)
30. The ltem_No and Cost column of a table "ITEMS" are given below:
Based on this information, find the output of the following queries:
a) SELECT AVG(COST) FROM ITEMS;
b) SELECT COST +100 FROM ITEMS WHERE ITEM_NO > 103;
32. Consider the table Projects given below. Write commands in SOL fori) and output for i) to iii)
i. To count the number of projects of cost less than 100000.
ii. SELECT SUM(Cost) FROM projects;
iii. SELECT ProjSize, COUNT(*) FROM Projects GROUP BY ProjSize;
34. What is the purpose of ORDER BY clause in MySql ? How is it different from GROUP BY clause?
35. Consider the Table SHOPPE given below. Write command in MySql
for (i) and output for (ii) to (iii).
36. Consider the table ‘PERSONS’ given below. Write commands in SQL for (i) to (iv) and write output for (i) to (iii).
(i) SELECT SUM(BasicSalary) FROM Persons Where Gender=’F’;
(ii) SELECT Gender,MIN(BasicSalary) FROM Persons
GROUP BY gender;
(iii) SELECT Gender,Count(*) FROM Persons GROUP BY
Gender;
37. There is a column HOBBY in a Table CONTACTS. The following two statements are giving different outputs. What
may be the possible reason ?
SELECT COUNT(*) FROM CONTACTS;
SELECT COUNT(HOBBY)FROM CONTACTS;
38. Consider the following table named "GYM" with details about fitness
items being sold in the store. Write output
42. What will be the output of the following queries on the basis of Employee table:
(i)Select avg(Salary) from Employee;
(ii) Select Salary+100 from Employee where EmpId='A002';
48. Kunal has entered the following SQL command on Table ‘STUDENT’ that has TotalMarks as one of the columns.
SELECT COUNT (*) FROM STUDENT;
The output displayed is 20.
Then, Kunal enters the following command :
SELECT COUNT (*) FROM STUDENT WHERE TotalMarks <100;
The output displayed is 15.
Then, Kunal enters the following command :
SELECT COUNT (*) FROM STUDENT WHERE TotalMarks >= 100;
He predicts the output of the above query as 5. Do you agree with Kunal ? Give reason for your answer.
49. Consider the table given below :
Write command for (i) and output for (ii)
(i) To display Area along with number of Salespersons working
in that area.
(ii) SELECT Area, COUNT (*) FROM Salesperson GROUP BY Area
HAVING COUNT (*) > 1;
51
What are the libraries used in Python.Explain how are libraries called in Python?