Page 39 - IPP-12-2025
P. 39

30. Write a Python program to create the following dataframe using a dictionary of lists:     [3]
                                                     Item         Cost      Stock
                                             0   Pen           10            500
                                             1   Notebook      50            200
                                             2   Eraser        5             700
                                             3   Pencil        15            600
                                                           Or
                 Write a Python program to create a Pandas series, as shown below, using a dictionary. Note that the left
                 column indicates the indices and the right column displays the data.
                                                 Earth             1 Moon
                                                 Mars             2 Moons
                                                 Jupiter          79 Moons
             31. (a)  Write an SQL statement to create a table named EVENTS with the following specifications:  [2+1=3]

                                        Column Name       Data Type           Key
                                      EventID          Numeric             Primary Key
                                      EventName        Varchar(40)
                                      EventDate        Date
                                      Location         Varchar(30)
                                      Participants     Numeric
                 (b) Write an SQL query to insert the following data in EVENTS table:
                     201, ‘Technology Conference 2024’, ‘2024-11-30’, ‘New York’, 500
             32. Consider the following tables:                                                            [3]
                 Table 1:
                 PATIENT, which stores Patient ID (P_ID), Patient Name (P_NAME), Age (AGE) and Gender (GENDER).
                 Table 2:
                 MEDICATION, which stores Patient ID (P_ID), Medication Name (MED_NAME), Dosage (DOSAGE).
                 Note: Attribute names are written within brackets.
                                                      Table: PATIENT
                                         P_ID      P_NAME       AGE     GENDER
                                         P1001  Vikas Suri       30   Male
                                         P1102  Rachit Mehra     35   Male
                                         P1103  Shivani Gupta    40   Female
                                         P1008  Jyoti Chawla     60   Female
                                         P1009  Avyaan Grover    23   Male
                                                    Table: MEDICATION
                                            P_ID     MED_NAME       DOSAGE
                                            P1001  Aspirin         100 mg
                                            P1102  Crocin          650 mg
                                            P1103  Levolin         0.63 mg
                                            P1008  Metformin       500 mg
                                            P1009  Amoxicillin     250 mg
                 Write appropriate SQL queries for the following:
                 (a) Display the list of female patients who are above the age of 40.
                 (b) Display patient names along with the medication they are prescribed.
                  (c) Display the maximum and minimum dosage of medication.
                                                           Or

              P.12       Informatics Practices with Python–XII
   34   35   36   37   38   39   40   41   42   43   44