Page 377 - TP_IT_V1.0_C10_flipbpookl
P. 377

Ans.      NAME          DATA TYPE           SIZE
                            ITEMNO         NUMERIC             5
                            NAME           VARCHAR             35
                             PRICE         DECIMAL             5
                           QUANTITY        NUMERIC             5
                           AMOUNT          DECIMAL             5
                    4.  Consider the following table:

                           EmpNo          EmpName         Designation
                             111            Sahil          Executive
                             222            Anup            Manager
                             333            Mansi            Head
                             444            Pooja          Executive
                       Using the above table, answer the following questions:
                       a. Identify the Primary key.
                       b. EmpName has all the unique names. Can it work as a primary key? Justify your answer
                  Ans.  Primary Key – EmpNo
                       No, EmpName cannot work as a Primary key because it may have unique values, but there are chances that a new employee
                       with the same name can join the company, so the field will have duplicate values and cannot be used as a primary key.
                    5.  Find out which of the following fields of table "Bank" can be selected as primary key, candidate key and alternate key?
                       Acc_No, Cust_Name, DOB, PAN_No, Opening_Bal.
                  Ans.  Primary key - Acc_No
                       Candidate key - Acc_No and PAN_No
                       Alternate key - PAN_No
                    6.  Differentiate between a Primary key and Foreign key. Explain with the help of an example.

                  Ans.        Feature                Primary Key                     Foreign Key
                             Definition     A primary key uniquely identifies   A primary key of one table when used
                                              each record (row) in a table.  in another table is called foreign key.
                            Uniqueness        Must contain unique values.    Values do not have to be unique.
                            Null Values       Does not allow NULL values.   Allows NULL values unless specified
                                                                                    with NOT NULL.
                             Purpose         Ensures entity integrity for the   Maintains referential integrity
                                                       table.                  between two related tables.
                              Usage         Used to uniquely identify rows in   Used to create a relationship between
                                                       a table.                        tables.
                             Constraint    Automatically creates a Unique and    Enforces data integrity by linking
                                                  Non-Null constraint.         tables via referenced keys.
                             Example          StudentID in Students table.  StudentID in Grades table referencing
                                                                                  Students(StudentID).
                    7.  List Numeric and Alphanumeric Datatypes in LibreOffice Base.
                  Ans.  The numeric data types are used to store data in the form of numbers which can be integers or real numbers with decimals.
                       Arithmetic operations can be performed on numeric data.
                          Data Type      Name           Signed                    Description
                         Tiny Integer   TINYINT           No         Store integer range between 0 to 255
                                                                                              15
                                                                                                    15
                         Small Integer  SMALLINT          Yes        Store integer range between -2  to + 2 -1
                                                                        Database Management System using LibreOffice Base  375
   372   373   374   375   376   377   378   379   380   381   382