Practile File-2024 EX - NO.16-20 and SQL Exercises
Practile File-2024 EX - NO.16-20 and SQL Exercises
NO:16
DATE:
AIM:
To create a python program to integrate mysql with python to display the avgmarks
greater than 75
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SQL Table
Output:
EX.NO: 17 DATE:
AIM:
To write a Python Program to integrate MYSQL with Python by inserting records to Emp
table and display the records.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
SQL OUTPUT:
EX.NO: 18
DATE:
DISPLAYING RECORDS)
AIM:
To write a Python Program to integrate MYSQL with Python to search an Employee using
EMPID and display the record if present in already existing table EMP, if not display the
appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
Run – 2:
SQL OUTPUT:
OUTPUT -1:
OUTPUT -2:
EX.NO: 19
DATE:
AIM:
To write a Python Program to integrate MYSQL with Python to search an Employee using
EMPID and update the Salary of an employee if present in already existing table EMP, if not
display the appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
Run -2:
SQL OUTPUT:
EX.NO: 20
DATE:
AIM:
To write a Python Program to integrate MYSQL with Python to search an Employee using
EMPID and delete the record of an employee if present in already existing table EMP, if not
display the appropriate message.
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
RUN – 2:
SQL OUTPUT:
Sql exercise -1
a. To show all information about the students of the history department
b. To list the names of female students who are in hindi department.
c. To list the names of all the students with their date of admission in descending order.
d. To display the students name, age, fee, for male students only.
e. To count the number of students with age less than 20.
TABLE STUDENT
TABLE DRESS
DCOD DESCRIPTIO PRIC MCOD LAUNCH
DATE
E N E E
10001 FORMAL 1250 M007 06-JUN-08
SHIRT
10020 FROCK 750 M004 06-SEPT-
07
10012 INFORMAL 1150 M002 06-JUN-08
SHIRT
10090 TULIP SHIRT 850 M003 31-MAR-
07
10019 EVENING 850 M003 20-OCT-08
GOWN
10023 PENCIL 1250 M003 20-OCT-08
SHIRT
10081 SLACHS 850 M003 09-MAR-
08
10007 FORMAL 1450 M001 20-OCT-08
PANT
10008 INFORMAL 1400 M002 07-APR-09
PANT
10024 BABY TOP 850 M003 06-JUN-08
TABLE MATERIAL
MCODE TYPE
M001 TERELENE
M002 COTTON
M003 POLYSTER
M004 SILK
ANSWERS.
A. SELECT DCODE, DESCRIPTION FROM DRESS ORDER BY DCODE;
B. SELECT * FROM DRESS WHERE LAUNCH DATE BETWEEN ’05-DEC-07’ AND ’20-JUN-08’
TABLE: STATIONARY
S_ID STATIONARY COMPANY PRICE
NAME
DP01 DET PEN ABC 10
PL02 PENCIL XYZ 6
ER05 ERASER XYZ 7
PL01 PENCIL CAN 5
GP02 GELPEN ABC 15
TABLE: CONSUMER
C_ID CONSUMER NAME ADDRESS S_ID
01 GOOD EARNER DELHI PL01
06 WHITE WELL MUMBAI GP02
12 TOPPER DELHI DP01
15 WRITE 4 DRAW DELHI PL02
16 MOTIVATION BANGALORE PL01
ANSWERS.
a.) SELECT * FROM CONSUMER WHERE ADDRESS=”DELHI”;
b.) SELECT * FROM STATIONARY WHERE PRICE BETWEEN 8 AND 15;
c.) SELECT CONSUMER NAME, ADDRESS ,COMPANY, PRICE FROM CONSUMER A,
STATIONARY B WHERE A.S_ID=B.S_ID;
d.) UPDATE STATIONARY SET PRICE=PRICE+2;
e.) INSERT INTO CONSUMER VALUES(17,”FAST WRITER”,”MUMBAI’,”GP01”);