Basic HTML Version

|  | Table of Contents |  | View Full Version

Page 143 - CodePilot V5.0 C8
P. 143

    2.  Consider the following PATIENTS table:

                                                              Table: PATIENTS
                                 Patient_ID    Patient_Name          Age            Disease          Doctor
                                   P001        Rahul                  20         Fever           Dr. Sinha
                                   P002        Maya                   34         Diabetes        Dr. Ahmed
                                   P003        Aman                   27         Flu             Dr. Sinha
                                   P004        Riya                   15         Asthma          Dr. Gupta
                                   P005        John                   40         Diabetes        Dr. Ahmed
                             Now, write SQL commands for the following:

                             (a)  Create a PATIENTS table under the Hospital database.
                             (b)  Insert a new patient “Priya”, age 25, Flu, doctor Dr. Sinha, Patient_ID P006.
                             (c)  Show names of all patients suffering from Diabetes.
                             (d)  List all details of patients being treated by Dr. Sinha.

                             (e)  Update the age of patient “Rahul” to 21.
                             (f)  Delete all records of patients younger than 18.

                                       CODE CHECK                                                  Century   #Critical Thinking
                                                                                                     21 st
                                                                                                    Skills
                        In a class, the following data shows the number of hours students spend on homework each week:
                        Student  A (4 hours),  Student  B (6  hours),  Student  C (2 hours),  Student  D  (5 hours) and
                        Student E (3 hours). Answer the following based on the given data:

                        (a)  What is the average number of hours students spend on homework?
                        (b)  Which student spends the most and the least time on homework?
                        (c)   If a new student, Student F, reports spending 7 hours on homework weekly, how would this
                            change the average?

                          JOB JUNCTION
                            A career in databases offers roles like database administrator, developer or analyst, managing
                            and analysing data for organisations across many industries.

                      PEDAGOGY PATHWAYS

                      «    Explain to students the different operators with different examples.
                      «     Explain to students the various types of SQL commands.

                                                                                                                      141
                                                                                              MySQL: My First Database

| 138 139 140 141 142 143 144 145 146 147 148 |