Page 141 - Informatics_Practices_Fliipbook_Class12
P. 141

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
                                           4              E0006                25



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


            A relational database management system (RDBMS) stores data in the form of relations, also called tables. A table has
            can be characterised as follows:
            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
                                                  Gautam Budh Nagar



                  Relational schema: Attribute names, types, constraints



            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.
               Degree of  a relation: No of attributes
                 The number of attributes in a relation is known as the degree of relation. For example, relation EMPLOYEE has
               degree  10,  relation  DEPARTMENT  has  degree  4,  and  each  of  the  relations  PROJECT and  WORKS_ON  has
               degree 3.


                                                                                        Database Query using SQL  127
   136   137   138   139   140   141   142   143   144   145   146