CS Worksheet (Evening)
CS Worksheet (Evening)
TIRUVANNAMALAI
CLASS:XII-A2/A3
SUBJECT:COMPUTER SCIENCE
WORKSHEET(EVENING)
1.
1. Pooja, a students of class XI, created a table "Book". Price is a column of this table. To find
the details of books whose prices have not been entered she wrote the following query:
Select * from Book where Price = NULL;
2. The LastName column of a table "Directory" is given below:
Based on this information, find the output of the following
queries:
a) SELECT lastname FROM Directory WHERE lastname like
"_a%";
5. Consider the table Projects given below. Write commands in SOL for i) to iii) and output for
iv)
7. Sarthya, a student of class XI, created a table "RESULT". Grade is one of the column of this
table. To find the details of students whose Grades have not been entered, he wrote the
following MySql query, which did not give the desired result.
SELECT * FROM Result WHERE Grade= "Null";
Help Sarthya to run the query by removing the errors from the query and write the correct
Query.
8. Consider the table RESULT given below. Write commands in MySql for (i) to (ii)
11. What is used in the SELECT clause to return all the columns in the table?
12. In MySQL, Sumit and Fauzia are getting the following outputs of ItemCodes for SELECT
statements used by them on a table named ITEM.(Both have used the SELECT statements
on the same table ITEM).
Sumit’s Output Fauzia’s Output
101 101
102 102
101 105
105 107
101
107
Which extra keyword has Fauzia used with SELECT statement to get the above output?
13. Consider the table ‘PERSONS’ given below. Write commands in SQL for (i) to (iv) and write
output for (v).
16. Consider the following table named 'SBOP" with details of account holders. Write
commands of MySql for (i) to (ii) and output for (iii).
17. When using the LIKE clause, which wildcard symbol represents any sequence of none, one
or more characters ?
18. Consider the table FLIGHT given below. Write commands in SQL for (i) to (iv) and output for
(v).
20. Pranay, who is an Indian, created a table named “Friends” to store his friend’s detail.
Table “Friends” is shown
below. Write commands in
SQL for (i) to (iii) and output
for (iv).
(iv) SELECT GNAME FROM GARMENT WHERE SIZE IN (‘M’, ‘L’) AND PRICE > 1500;
22. Consider the table ‘empsalary’.
To select tuples with some salary ,Siddharth has written the following
erroneous SQL
statement:
SELECT ID, Salary FROM empsalary WHERE Salary = something;
Note : Columns SID and DOB contain Sales Person Id and Data of Birth respectively.
(i) Write the data types of SID and DOB columns.
(ii) Display names of Salespersons and their Salaries who have salaries in the range
30000.00 to 40000.00
(iii) To list Names, Phone numbers and DOB (Date of Birth) of Salespersons who were born
before 1st November, 1992.
(iv) To display Names and Salaries of Salespersons in descending order of salary.
(v) To display areas in which Salespersons are working. Duplicate Areas should not be
displayed.
(vi) To display SID, Names along with Salaries increased by 500. (Increase of 500 is only to
be displayed and not to be updated in the table)
(vii) To display Names of Salespersons who have the word ‘Kumar’ anywhere in their
names.
32. Write the following statement using ‘OR’ logical operator :
SELECT first_name, last_name, subject FROM studentdetailsWHERE subject IN (‘Maths’,
‘Science’);
33. Consider the Table “Gym” shown below. Write commands in SQL for (i) to (vi) :
(i) To display Mname, Age, FeeGiven of those members whose fee is above 12,000.
(ii) To display Mcode, Mname, Age of all female members of the Gym with age in
descending order.
(iii) To list names of members and their date of admission of those members who joined
after 31st December, 2015.
iv) To display the Mname, FeeGiven of all those members of the Gym whose age is less
than 40 and are monthly type members of the Gym.
(v) To display names of members who have ‘mit’ anywhere in their names. For example :
Amit, Samit.
(vi) To display types of memberships available. Duplicate values should not be displayed.
34. Consider the following table:
Write commands in SQL for (i) to (iv) and
output for (v):
i.To display the details of all those students
who have IP as their optional subject.
ii. To display name, stream and optional
of all those students whose name starts with
‘A’.
iii. To give an increase of 3 in the average
of all those students of humanities section who
have Maths as their optional subject.
iv. To display a name list of all those
students who have average more than 75.
v. Select name from students where optional IN (‘CS’,’IP’);