Grade: 12 Computer Science
DBMS
Worksheet - 1
2 Marks
1. Explain the use of ‘Foreign Key’ in a Relational Database Management System. Give
example to support your answer
2. Differentiate between order by and group by clause in SQL with appropriate example.
3. Categorize the following commands as DDL or DML: INSERT, UPDATE, ALTER, DROP
4.Mention two differences between a PRIMARY KEY and a UNIQUE KEY.
5. A MySQL table, sales have 10 rows. The following queries were executed on the sales
table.
SELECT COUNT(*) FROM sales; SELECT COUNT(discount) FROM sales;
Count(*) Count(discount)
10 6
Write a statement to explain as to why there is a difference in both the counts.
6. What is the difference between a Candidate Key and an Alternate Key
7. Differentiate between DDL and DML with one Example each.
8. Write the output of the queries (a) to (d) based on the table
(a) SELECT min(Population) FROM country;
(b) SELECT max(SurfaceArea) FROM country Where Lifeexpectancy<50;
(C)SELECT avg(LifeExpectancy) FROM country Where CName Like "%G%";
(d) SELECT Count(Distinct Continent) FROM country;
DBMS - Worksheet – 1- 2 Marks Page 1
9.
(a) Identify the candidate key(s) from the
table Country.
(b) Consider the table CAPITAL given below:
Which field will be considered as the foreign
key if the tables COUNTRY and CAPITAL are
related in a database?
10. Write two points of difference between ALTER and UPDATE command in SQL.
11. Categorize the following commands as DDL or DML: DROP, DELETE, SELECT,
ALTER
12. Explain the use of primary key in a relational database system? Give example to
support your answer?
13. Define Tuple and Attribute with appropriate example.
14. Explain the use of “Primary key in a Relational Database Management System.
Give example to support your answer
15. Differentiate between DDL and DML?
16. Write the main difference between INSERT and UPDATE Commands in SQL
17. Differentiate between ‘WHERE’ clause and ‘HAVING’ clause in MySQL with
appropriate example.
18. Differentiate between DELETE and DROP keywords used in MySQL,giving suitable
example for each
19. Define Primary Key of a relation in SQL. Give an Example using a dummy table.
20. Consider the following Python code is written to access the record of CODE passed to
function: Complete the missing statements:
def Search(eno):
#Assume basic setup import, connection and cursor is created
query="select * from emp where empno=________".format(eno)
mycursor.execute(query)
results = mycursor._________
print(results)
21. What is a cursor and how to create it in Python SQL connectivity?
22. What is Degree and Cardinality in relational table?
23. Answer the following :
DBMS - Worksheet – 1- 2 Marks Page 2
i) Name the package for connecting Python with MySQL database.
ii) What is the purpose of cursor object?
24 What do understand by an Alternate key? Give a suitable example to support your
answer.
25. What do you mean by domain of an attribute in DBMS? Explain with an example.
DBMS - Worksheet – 1- 2 Marks Page 3