You are on page 1of 4

SAN ACADEMY GROUP OF SCHOOLS

VELACHERY/PALLIKARANAI/KAMAKOTI NAGAR/TAMBARAM
WORKSHEET
SUBJECT: COMPUTER SCIENCE

NAME :
CLASS : XII SEC: DATE:

Chapter 13 : Table creation and data manipulation commands

I Answer the following


1. What do you mean by degree and cardinality of table?
Ans: Degree is the number of attributes or columns present in a table. Cardinality is the number of tuples or
rows present in a table.

2. What is use of commit command in SQL?


Ans: A COMMIT command in Structured Query Language(SQL) is a transaction command that is used to
save all changes made by a particular transaction in a relational database management system since the last
COMMIT or ROLLBACK command.

3. Expand DDL and DML


Ans: Data Definition Language, Data Manipulation Language

4. Select count(*) from book; will return total number of records from table book. (T/F)
5. Delete command is DDL command. (T/F)
6. Which command is used to increase the salary of employees in table emp? (Update / Alter)
7. Name the command used to see the structure of table. (DESC tablename)
8. Write a query to display details of all employees whose name(e_name) start with alphabet ‘a’ from table emp.
Ans: SELECT * FROM EMPLOYEE WHERE e_name like ‘%a’;

9. What is the difference between alter and update command?


II Case base questions

1. Write the queries of the following on the basis of given table : Faculty

1. Display details of Faculties who joins after 1990.

SELECT * FROM FACULTY WHERE DOJ > ‘


2. Display details of Faculties whose salary is more than 20000.

SELECT * FROM FACULTY WHERE FSAL > 20000;

3. Show the name of faculties whose DOJ is 12-10-1980.

SELECT FNAME FROM FACULTY WHERE DOJ = ‘12-10-1980’;

4. Display the detail of faculties whose name start from alphabet ‘A’.

SELECT * FROM FACULTY WHERE FNAME LIKE ‘%A’;

5. Display details of faculties whose salary is greater than 25000 and name ends with ‘n’.

SELECT FNAME FROM FACULTY WHERE FSAL = 25000 AND NAME LIKE ‘n%’;

6. Count number of faculties whose name starts with ‘S’ and salary more than 40000.

SELECT count(*) FROM FACULTY WHERE FSAL > 40000 AND FNAME LIKE ‘%S’;

7. Display all records in increasing order of name.

SELECT * FROM FACULTY ORDER BY FNAME;

2. Write the output of the following on the basis of given

Table : Product
1. Select max(price) from product;
MAX(PRICE)

320

2. Select avg(price) from product;


AVG(PRICE)

218

3. Select min(qty) from product;


MIN(QTY)

17

4. Select count(*) from product;


COUNT(*)

5. Select count(Qty) from product;


COUNT(QTY)

6. Select distinct(price) from product;


DISTINCT(PRICE)

240

300

320

130
100

7. Select count(distinct(price)) from product;


COUNT(DISTINCT(PRICE))

8. Select price * Qty from product;


PRICE*QTY

5520

7200

13760

4160

1700

9. Select sum(price) from product;


SUM(PRICE)

1090

10. Select sum(price) where Qty > 30;


SUM(PRICE)

450

End of Page

You might also like