EX - No.15-20 and SQL Exercises
EX - No.15-20 and SQL Exercises
EX - No.15-20 and SQL Exercises
NO:15
DATE:
AIM:
SOURCE CODE:
Result:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
+
EX.NO: 16
DATE:
CREATING A PYTHON PROGRAM TO IMPLEMENT STACK OPERATIONS
AIM:
Thus, the above Python program is executed successfully and the output is verified.
SAMPLE OUTPUT:
DATE:
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:
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:
RECORDS)
AIM:
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’
C. SELECT AVG(PRICE) FROM DRESS WHERE DCODE =”M008”;
D. SELECT MCODE, MAX(PRICE),MIN(PRICE)FROM DRESS GROUP BY
MCODE; SELECT DESCRIPTION, TYPE FROM DRESS D, MATERIAL
WHERE D.CODE=M.CODE;
sq1 Exercise-3
a.) To display the details of those consumer whose address is delhi
b. To display the details of stationary whose price is in the range of 8 to 15.
c. To display the consumer name, address from table consumer and company and price from table
stationary with their corresponding matching S_ID.
d.) To increase the price of all the stationary by 2.
e. add a new record in consumer table with following details.
(17,”FAST WRITER”, “MUMBAI”,”GPO1”);
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 SETPRICE=PRICE+2;
e.) INSERT INTO CONSUMER VALUES(17,”FAST WRITER”,”MUMBAI’,”GP01”);