CS Revision Test-V QP
CS Revision Test-V QP
i) select Name, Dateofadm from HOSPITAL where Department = "ENT" and sex like 'F'
ii) select Department, count(*), min(Charges) from HOSPITAL group by Department having
count(Department)>2;
iii) select distinct(Department) from HOSPITAL order by Department;
OR
b) Write the outputs of the SQL queries (a) to (c) base on the relations Emp and Eaddress given
below:
i) select e.no,e.name,e.salary,a.address,a.city from emp e, Eaddress a where e.salary>5000 and
a.city='Mumbai' and a.no=e.no;
ii) Select no,name, dept from emp where name LIKE “_ _ e%”;
iii) Select dept,count(no),sum(salary) from emp where gender=”M” group by dept HAVING
sum(salary)>10000;
i) Write a SQL query to display Salesman, cust_name and city from above table where
the salesperson and customer belongs to same city.
ii) write a SQL query to display ord_no, purch_amt, cust_name, city of those orders
where order amount exists between 500 and 2000.
iii) Write a SQL query to display Customer Name, city, Salesman, commission the all
salesperson(s) and their respective the customer(s).
OR
b) Answer the questions (i) to (iii) on the basis of the following tables SHOPPE
and ACCESSORIES
(i) To display Name and Price of all the ACCESSORIES in ascending order
of their Price.
(ii) To display Id and SName of all SHOPPE located in Nehru Place.
(iii) To display Minimum and Maximum Price of each Name of
ACCESSORIES.
31 a) What is resultset? Write code to execute the query “Select * from student” and store the retrieved
record in the cursor object after creating cursor
b) Differentiate between fetchone() and fetchmany()
Q.No SECTION D(4X4=16)
MARK
S
32 Write SQL queries for (i) to (iv) based on the tables PASSENGER and FLIGHT given below:
4
i) Write a query to display the NAME, corresponding FARE and F_DATE of all passengers who
have flight to start from “DELHI”.
ii) Insert the following record into the table: Passenger. PNO-1005, NAME-Kavi, GENDER-
FEMALE, FNO-F104
iii) Write a query to delete the records of flights which ends at ”MUMBAI”.
iv) Add a column REMARKS in FLIGHT table with data type as varchar with 30 characters
33 Write a program to integrate Python with MySQL to create a table, insert the records (two records) in to
4
the table and display it.
Table name: emp
Record Type: Eno-integer, Name-string of 20 characters, Salary-float.
Note: The values of fields Eno, Name and Salary has to be accepted from the user. Name the
following to establish connectivity between Python and Mysql:
Host=”localhost”, user name=”root”, password="tiger", db="employee".
34 Mayank creates a table RESULT with a set of records to maintain the marks secured by students in sub1, sub2,
4
sub3 and their GRADE. After creation of the table, he has entered data of 7 students in the table
And also they have a Cricket ground 2000 KM away from the school wing.
i)Suggest the cable layout of connections between the buildings and the topology thus formed
(school wings only).
ii) Suggest the most suitable place (i.e. building) to house the server of this school, provide a suitable
reason.
iii) Suggest the placement of the following devices with justification.
a) Repeater b) Hub /Switch
iv) The organization also has Inquiry office in another city about 50-60 Km away in a Hilly Region.
Suggest the suitable transmission media to interconnect the school and Inquiry office out of the
following o Fiber Optic Cable o Microwave o Radio wave What would be the type of network thus
formed?
v) Which fast and very effective wireless transmission medium should preferably be used to connect
the school wing at MUMBAI with the Cricket ground for live Telecast?
37 Consider the following python and MySql connectivity code and answer the following questions:
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="12345",database=
"student")
if mydb.is_connected()==True:
print("connection ok")
else:
print("error connecting to mysql database")
mycursor=mydb.cursor()
r=int(input("enter the rollno"))
n=input("enter name")
m=int(input("enter marks"))
mycursor.execute("INSERT INTO student(rollno,name,marks) VALUES({},'{}',{})".format(r,n,m))
mydb.commit()
print(mycursor.rowcount,"RECRD INSERTED")
(i) Which of the following statement is connecting database server?
(ii) What is the role of the statement ‘mycursor=mydb.cursor()’?
(iii) Which statement will add record to the table?
(iv) What is the purpose of the ‘cursor.rowcount in the following print statement.
print(mycursor.rowcount,"RECRD INSERTED")
(v) What is the purpose of ‘mydb.commit()’ ?