Page 279 - PYTHON-12
P. 279

Thus, the output for the above command will be:
                 Resultant Table
               Rollno      Name        Fee
                  2     Jaya         5500
                  3     Teena        5000
                  4     Diksha       4500

              2.  Outer Join: The Outer Join keyword returns all rows from the right table (table 2), with the
                 matching rows in the left table (table 1). The result is NULL in the left side when there is no
                 match.
                 mysql> SELECT A.Rollno, Name, fee

                 FROM student A, fees B WHERE
                                                                                         OUTER JOIN
                 A.Rollno = B.Rollno ORDER BY B.fee desc;
                 Resultant Table
               Rollno      Name        Fee
                  2     Jaya         5500                                          table 1          table 2
                  3     Teena        5000
                  4     Diksha       4500
                 Note: Self, Non-equi and Natural join are beyond the scope of this book.

                 Let us take an example of two tables to explain the concept of MySQL Joins: (Question taken
                 from CBSE 2015-16 Board Paper)
                                                      Table: Vehicle

                                             CODE         VTYPE         PERKM
                                              101   VOLVO BUS             160
                                              102   AC DELUXE BUS         150
                                              103   ORDINARY BUS          90
                                              105   SUV                   40
                                              104   CAR                   20

              Note:

              •  PERKM is Freight Charges per kilometre
              •  VTYPE is Vehicle Type
                                                      Table: Travel

                                 NO        NAME         TDATE       KM      CODE      NOP
                                 101   Janish Kin     2015–11–13    200      101       32
                                 103   Vedika Sahai   2016–04–21    100      103       45
                                                                                                                  Relational Database and SQL
                                 105   Tarun Ram      2016–03–23    350      102       42
                                 102   John Fen       2016–02–13     90      102       40
                                 107   Ahmed Khan     2015–01–10     75      104        2
                                 104   Raveena        2016–05–28     80      105        4








                                                                                                            12.49
   274   275   276   277   278   279   280   281   282   283   284