Page 250 - Information_Practice_Fliipbook_Class11
P. 250

Relation: WORKS_ON

                                                 +---------+--------+-------+
                                                 | Proj_No | Emp_ID | Hours |
                                                 +---------+--------+-------+
                                                 |       1 |  E0001 |    23 |
                                                 |       2 |  E0005 |    18 |
                                                 |       3 |  E0002 |     4 |
                                                 |       2 |  E0002 |     4 |
                                                 |       4 |  E0010 |    30 |
                                                 |       5 |  E0009 |    10 |
                                                 |       4 |  E0007 |     8 |
                                                 |       1 |  E0003 |    17 |
                                                 |       1 |  E0008 |    21 |
                                                 |       2 |  E0006 |    25 |
                                                 +---------+--------+-------+
                                                 Fig 9.3: COMPANY Database

        A relational database management system (RDBMS) stores data in the form of relations, also called tables. A table has
        can be characterised as follows:

               Attribute: A column in a table.
               Value in a column: Must confirm to Attribute type.

        1.   Each column of a table represents a unique attribute. For example, the table EMPLOYEE comprises ten columns
            representing  ID,  FName,  LName,  Gender,  Address,  City,  Pin_Code,  DOB,  Salary, and  Dept_No.
            Similarly, the table DEPARTMENT comprises attributes, Dept_No, Dept_Name, Location, and Mgr_Id, the
            table PROJECT comprises the attributes, Proj_No, Proj_Name, and Dept_Num, and the table  WORKS_ON
            comprises attributes, namely, Proj_No, Emp_Id, and Hours. One row of a table stores information about all
            attributes of an entity. For example,  the following row of table EMPLOYEE stores information about an employee
            having  ID E0005, FName Anshul, LName Verma, Gender M, Address House 10, Sector 16, Gautum
            Budh Nagar, City Noida, Pin_Code 201304,  DOB 01-Jan-1990, Salary 100000 and Dept_No 1.


        +-------+--------+--------+--------+--------------------------------+-----------+----------+------------+--------+---------+
        | E0005 | Anshul  | Verma  | M      | House 10, Sector 16,           | Noida     | 201304   | 1990-01-01 | 100000 |       1 |
        |       |         |        |        | Gautum Budh Nagar              |           |          |    |    |         |
        +-------+--------+--------+--------+--------------------------------+-----------+----------+------------+--------+---------+
        2.  Relational schema describes the structure of a relation. It includes the names of attributes of a table, types of
            attributes, and the constraints on a table.  Consider the relation schema of EMPLOYEE relation:

              EMPLOYEE(ID, FName, LName, Gender, Address, City, Pin_Code, DOB, Salary, Dept_
            No).
              The names of the relations and the attributes must relate to the attribute's real-world meaning. For example,
            FName and LName denote the first name and last name in the EMPLOYEE relation, respectively. The rest of the
            attribute names are self-explanatory.


               Relational schema: Attribute names, types, constraints.


        3.   The  number  of  attributes  in  a  relation  is  known  as  the  degree  of  relation.  For  example,  relation  EMPLOYEE
            has degree 10, the relation DEPARTMENT has degree 4, and each of the relations PROJECT and WORKS_ON has
            degree 3.



               Degree of a relation: No of attributes.




          236  Touchpad Informatics Practices-XI
   245   246   247   248   249   250   251   252   253   254   255