Consider the following employee database. (RGPV 2019)
Employee (empname,street, city)
work (empname,companyname,salary)
company (companyname,city)
manages (empname,management).
Give an expression in the SQL for each request.
Consider the following employee database. (RGPV 2019)
Employee (empname,street, city)
work (empname,companyname,salary)
company (companyname,city)
manages (empname,management).
Give an expression in the SQL for each request.
Explain the concepts of Generalization and Aggregation with appropriate examples. (RGPV 2019)
Ans. Generalization:
Entities with common attributes can be merged into a generic or super type entity by generalisation.
For example, the entity EMPLOYEE is a super type of Professor, Conductor, and Engineer.
|
Student |
|
RollNo |
Name |
Department |
010 |
Sanjay |
CSE |
012 |
Ram Prasad |
ME |
021 |
Natwarlal |
CSE |
Account(Student) |
|
RollNo |
A/C No. |
010 |
0074100 |
031 |
005452010 |
040 |
14540000 |
Primary Key |
Foreign Key |
No duplicate value. |
Duplicate values allowed. |
Null values not allowed. |
Null values allowed. |
Uniquely identified. |
May be uniquely |
It’s indexed automatically. |
No automatic index. |
Feature |
Conceptual |
Logical |
Physical |
Entity names |
✔ |
✔ |
✔ |
Entity relationships |
✔ |
✔ |
✔ |
Primary keys |
|
✔ |
✔ |
Foreign keys |
|
✔ |
✔ |
Column names |
|
|
✔ |
Column data types |
|
|
✔ |
Database approach |
Traditional file accessing approach |
All Application shares a pool of related and integrated data. |
Use separate data file for each application |
Minimal data redundancy – Separate data files are integrated in to a single, logical structure. |
Data redundancy – independent data files included a lot of duplicated data. |
Each occurrence of a data item is recorded only once. |
Same data is recorded and stored in several files. |
Single version of data exist |
Data inconsistency – several versions of the same data may exist. |
Single update is required. |
Same update must be done in all occurrences of same data item in each file. |
A database is developed to share the data among the user who access to it |
Users have very little opportunity to share data outside of their own application. |
There is centralized control for overall data in database. |
There is no centralized control for overall data in different files. |
Data independence – the database system separates data descriptions from the application programs that use the data in it |
Data dependence – description of files, records and data items are embedded within individual application programs. |
Data structure can be modified without changing the programs accessing the data |
Modification to data files requires the programs which access that file to be modified. |
Less program maintenance |
High program maintenance |
Data are organized in to a single logical structure with logical relationships defined between associated data |
Lack of data integration – accessing data in several files are difficult |