Posts

Lecture 5 - Entity Relationship Diagram

Image
ERD is a way of representing database relations in a graphical form. As you know that the entities are represented using rectangle and attributes using ovals. Let’s revisit the relationship of a teacher and student. As you can see that one teacher teaches many students. First Relation   Second Relation Similarly, many subjects are studied by many students. Merge Relations       Now! You must be thinking what is the relationship of teacher and subject? Probably your answer is many-to-many . . . I would rather disagree with your point of view; the reason will be discussed with you when we would implement this ERD in a DBMS. The completed ERD would be Finalized Relations That was simple ERD; it cannot be implemented in any DBMS. What else is required? What is missing? Do you remember the term ‘attribute’? Yes the answer is ‘attributes’ which are not defined. Let’s define some attributes ...

Lecture 4 - Database Design Process

Image
Before we can design a database, we need to learn some important concepts related to it. Entity An entity is anything for which data is stored and maintained. For example: Student, Teacher, Player, Customer, Order, Course, Department etc. Diagrammatically they are represented as a rectangle. Attribute Properties of an entity are called its attributes. For example Student’s attributes are AdmNo, Name, Father’s Name etc. Diagrammatically they are represented by an oval. Relationship A logical connection between entities is called a relationship. Cardinality The types of relationship between entities, following are the types of relationships between the entities. One-to-One In one-to-one relationship only one instance of an entity is related to only one instance of another entity.     Figure 2 - One-to-One Relationship One-to-Many In one-to-many type of relationship one instanc...

Lecture 3 - Database Keys

Image
Keys are very important concept in database. They allow us to extract, sort, manipulate and create relationships in the database. Candidate Key An attribute or a set of attribute that is/are capable of uniquely identifying a record in a relation is called a candidate key. AdmNo Name Father’s Name Class Address Phone 13056 M. Zulqarnain M. Anar XII New Sadiq Lines 052-1234567 13001 Ibrar Zeb Jehanzeb Khan XII Sadiq Lines 052-9784661 12096 M. Waqas Latif M. Latif XII Narrowal 052-7841561 50179 M. Faheem Ahsan M. Ahsan XI HQ 15 Div 052-1341313 50017 M. Rizwan M. Ramzan XI Dalowali 052-1234568 10996 Rana Ubaid Ashraf M. Ashraf XI ...