Page 22 - IPP-12-2025
P. 22

Table: DEPARTMENTS
                                            Department_ID     Department_Name
                                                D0001        Human Resources
                                                D0002        IT
                                                D0003        Finance
                 Write appropriate SQL queries for the following:
                 (a) Display the total number of employees department-wise.
                 (b) Display  the  names  of  all  employees  who  belong  to  Human  Resources  department  in  uppercase
                     along with their department name.
                  (c) Display the name, age and the department name of employees whose age is more than 25.
            Ans.  (a)  Select Brand from MOBILE where Release_Year > 2020;
                 (b) Select Model, Usage_Type from MOBILE m, Usage_History h where m.M_ID = h.M_ID;
                  (c) Select M_ID, sum(Usage_Time) from USAGE_HISTORY group by M_ID;
                                                           Or
                 (a) Select  Department_ID,  count(Employee_ID)  from  EMPLOYEES  group  by
                     Department_ID;
                 (b) Select upper(Employee_Name), Department_Name from EMPLOYEES e, DEPARTMENTS d
                     where e.Department_ID = d.Department_ID;
                  (c) Select Employee_Name, Age, department_name from employees e, departments d
                     where e. Department_ID = d. Department_ID and Age>25;

                                                Section D (2 × 4 = 8 Marks)
             33. Ravi,  a  data  analyst,  is  preparing  a  line  chart  to  visualize  monthly  temperatures  (in  Celsius)  for  a  city
                 over the past six months. The temperature data (in Celsius) is as follows:                [4]
                                                 Month        Temperature (°C)
                                              January       10
                                              February      12
                                              March         15
                                              April         18
                                              May           22
                                              June          25

                 Help Ravi to complete the following Python code to generate the line chart:
























                 import as plt                  # Statement 1
                 months = ['January', 'February', 'March', 'April', 'May', 'June']
                 temperature = [10, 12, 15, 18, 22, 25]
                 plt.plot(months,       ,color='blue',marker='o',label='Temperature') # Statement 2

            M.19         Informatics Practices with Python–XII
            38
   17   18   19   20   21   22   23   24   25   26   27