18CSC303J - Database Management System UNIT 2 & 3 - 12 MARKS
12M:
Phases of database lifecycle along with diagram
Phase 1: Database initial Study
Phase 2: Database Design
Most critical DBLC phase
Makes sure final product meets requirements
Focuses on data requirements
Sub-phases
Create conceptual design
DBMS software selection
Create logical design
Create physical design
Phase 3: Implementation and Loading
Creation of special storage related constructs to house end user tables
Data loaded into tables
Other issues
Performance
Security
Backup and recovery
Integrity
Company standards
Concurrency controls
Phase 4: Testing and Evaluation
Database is tested and fine-tuned for performance, integrity, concurrent access and security constraints
Done in parallel with application programming
Actions taken if tests fail
Fine tuning based on reference manuals
Modification of logical design
Modification of physical design
Upgrade or change DBMS software or hardware
Phase 5: Operation
Database considered operational
Starts process of system evaluation
Unforeseen problems may surface
Demand for change is constant
Phase 6: Maintenance and Evaluation
Types of maintenance
Preventative maintenance
Corrective maintenance
Adaptive maintenance
Assignment of access permissions
Periodic security audits
Periodic system usage summaries
Generation of database access statistics to monitor performance
Extended ER features with diagram
The extended features are
Generalization
Specialization
Aggregation
These features are used for data abstraction in which abstraction mechanisms are used to hide details of a set of objects
Generalization:
It is the process of extracting common properties from a set of entities and create a generalized entity from it
It is a bottom up approach
For example, STUDENT and FACULTY can be generalized to higher level entity called PERSON
In this case, P_NAME and P_ADD become part of PERSON and S_FEE becomes part of STUDENT
Specialization:
Specialization is an inversion of generalization
In specialization, an entity is divided into sub entities based on their characteristics
It is a top down approach
For example, EMPLOYEE entity in an employee management system can be specialized into DEVELOPER, TESTER etc
In this case, E_NAME, E_SAL etc become part of EMPLOYEE and TES_TYPE become part of TESTER
Aggregation:
An ER diagram is not capable of representing relationship between entity and a relationship which may be required in some scenarios
In those cases, a relationship with its corresponding entities is aggregated into a higher level entity
For example, EMPLOYEE working for a PROJECT may require some machinery. So REQUIRE relationship is needed between relationship WORKS_FOR and entity MACHINERY
In this case, WORKS_FOR relationship with its entities EMPLOYEE and PROJECT is aggregated into single entity
Various join statement with syntax and example
A SQL join statement is used to combine data or rows from two or more tables based on a common field between them
Different types of joins are:
INNER JOIN
LEFT JOIN
RIGHT JOIN
FULL JOIN
INNER JOIN:
Returns records that have matching values in both tables
Selects all rows from both tables as long as the condition is satisfied
SELECT STUDENT.NAME, STUDENT.AGE, STUDENTCOURSE.COURSE_ID FROM STUDENT INNER JOIN STUDENTCOURSE ON STUDENT.ROLL_NO = STUDENTCOURSE.ROLL_NO;
LEFT JOIN:
Returns all records from the left table and the matched records from the right table
Returns all the rows of the table on the left side of the join and matching rows for the table on the right side of join
AKA left outer join
SELECT STUDENT.NAME, STUDENTCOURSE.COURSE_ID FROM STUDENT LEFT JOIN STUDENTCOURSE ON STUDENTCOURSE.ROLL_NO = STUDENT.ROLL_NO;
RIGHT JOIN:
Returns all records from the right table and the matched records from the left table
Returns all the rows of the table on the right side of the join and matching rows for the table on the left side of join
AKA right outer join
SELECT STUDENT.NAME, STUDENTCOURSE.COURSE_ID FROM STUDENT RIGHT JOIN STUDENTCOURSE ON STUDENTCOURSE.ROLL_NO = STUDENT.ROLL_NO;
FULL JOIN:
Returns all records when there is a match in either left or right table
Returns all the rows from both the tables
AKA outer join or full outer join
SELECT STUDENT.NAME, STUDENTCOURSE.COURSE_ID FROM STUDENT FULL JOIN STUDENTCOURSE ON STUDENTCOURSE.ROLL_NO = STUDENT.ROLL_NO;
Comments
Post a Comment