0% found this document useful (0 votes)
8 views3 pages

Class XII CS FP Slip Test 4 Answer Keyfor B - CS

The document is an answer key for a slip test on Database Management Systems (DBMS) with a maximum score of 20 marks. It includes various SQL queries and concepts such as Foreign Keys, SELECT statements, and database connections using Python's mysql.connector. The questions cover topics like data retrieval, aggregation functions, and basic database operations.

Uploaded by

akilasathish79
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views3 pages

Class XII CS FP Slip Test 4 Answer Keyfor B - CS

The document is an answer key for a slip test on Database Management Systems (DBMS) with a maximum score of 20 marks. It includes various SQL queries and concepts such as Foreign Keys, SELECT statements, and database connections using Python's mysql.connector. The questions cover topics like data retrieval, aggregation functions, and basic database operations.

Uploaded by

akilasathish79
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Subject Code / Title : 083 - Computer Science Slip Test - 4

Answer Key Maximum Marks: 20


Portions: DBMS

Q.No Questions Mark


1 b) Foreign Key 1
2 (C)SELECT Movie_Name FROM MOVIE WHERE Movie_Name LIKE ‘%No-1’; 1
3 a. HAVING 1
4 d) A table with a Primary Key column must have an alternate key. 1
5 (B) COUNT( ) 1
7 (d) delete from student; 1
8 i) Select * from MOVIE where PRICE between 200 and 275; 2

ii) select * from MOVIE where TITLE like ‘%I’ or RATING=’B’;

9 Write the output of the queries (i) to (iv) based on the table “Product”, 4
showing details of products being sold in a grocery shop.

i) SELECT PName, Average (UPrice) FROM Product GROUP BY Pname;


ii) SELECT DISTINCT Manufacturer FROM Product;

iii) SELECT COUNT (DISTINCT PName) FROM Product;

iii)SELECT PName, MAX(UPrice), MIN(UPrice) FROM Product GROUP BY


PName;

10 (i) SELECT FIRSTNAME, LASTNAME,ADDRESS,CITY FROM 4


EMPLOYEES;
((ii) SELECT * FROM EMPLOYEES ORDER BY FIRSTNAME DESC;
(iii) SELECT FIRSTNAME,LASTNAME, EMPSALARY.SALARY
FROM EMPLOYEES,SALARY WHERE EMPLOYEES.EMPID =
EMPSALARY.EMPID AND
EMPSALARY.DESIGNATION=”MANAGER”;
(IV) SELECT MAX(EMPSALARY.SALARY) FROM EMPSALARY
WHERE EMPSALARY.DESIGNATION = “MANAGER” OR
EMPSALARY.DESIGNATION=”CLERK”;
(V)SELECT AVG(EMPSAALRY.SALARY) FROM EMPSALARY
WHERE EMPSALARY.DESIGNATION=”CLERK”;
11 import mysql.connector 4
conn=mysql.connector.connect(host="localhost",user="root",passwd="tiger",
database="company")
if conn.is_connected()==False:
print("Error connecting to MYSQL DATABASE")
c=conn.cursor()
c.execute("select * from Employee where salary>15000")
r=c.fetchall()
count=c.rowcount
print("total no of rows:",count)
for row in r:
print(row)

You might also like