Page 48 - DCAP402_DCAO204_DATABASE MANAGEMENT SYSTEM_MANAGING DATABASE
P. 48

Unit 3: Structured Query Language




          6.   Qualification: It  is a  boolean  expression  representing a  condition containing  logical  Notes
               connectives and also comparison operators.
          The following tables are used throughout the unit:

          Employee


               Eid       Ename        DNo        Esal       Age           Phone
              101     John             2            35000       50       24578912
              100     Harry            3            18000       29       33273120
              107     Henry            7            22000       25       55809192
               97     David            5            30000       41       23535135
              108     Sam              1            25000       32       24532121
              102     Henry            2            22000       35       24578290
              120     Smith            4            20000       2        56408489
              122     David            6            18000       25       24517635

          Department

                Dept_Managerid     DNo         Dname            Dlocation      PNo
                     108             1    Administration   Hyderabad            44
                     101             2    Accounts         Secunderabad         11
                     100             3    Packaging        Bombay               44
                     120             4    Research         Nellore              33
                     97              5    Accounts         Hyderabad            22
                     122             6    Operation        Pune                 44
                     107             7    Packaging        Bangalore            55

          Project

                PNo           Pname             Pduration          Project_Managerid
               11               A        9 Months                         102
               22               B        14 Months                        97
               33               C        16 Months                        120
               44               D        25 Months                        108
               55               E        9 Months                         107

                 Example: Consider a simple query,
          Query (a): Select the names and salaries of the employees whose salary is greater than 20000.
          Solution:
          SELECT DISTINCT E.ename, E.esal

          FROM Employee E
          WHERE E.esal > 20000.







                                           LOVELY PROFESSIONAL UNIVERSITY                                   41
   43   44   45   46   47   48   49   50   51   52   53