Database Design Dr M E Fayad Professor Computer
Database Design Dr. M. E. Fayad, Professor Computer Engineering Department, Room #283 I College of Engineering San José State University One Washington Square San José, CA 95192 -0180 http: //www. engr. sjsu. edu/~fayad 11/26/2020 L 3 -S 1 Practical Solutions
Lesson 3: ERDs & Class Diagrams for 1. School 2. File System 3. Kitchen 2 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 2 Practical Solutions
Lesson Objectives How to Create an ERD or Class Diagrams n Business Rules n School’s ERD or Class Diagram n File System’s ERD or Class Diagram n Kitchen’s ERD or Class Diagram n 3 11/26/2020 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 3 Practical Solutions
How to Create an ERD or Class Diagram for Any Problem n Write the business rules n Create a model for each Business Rule n Connect the resulted models based on the business rules n Validate and test the ERD or the Class Diagram 4 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 4 Practical Solutions
School: Business Rules (1) n A school has a principal, many students, and many teachers. Each of these persons has a name and a birthdate, and may borrow and return books. Person Book 0. . * Borrows title author loan return Principal salary birthdate Student evaluate. Teacher() 0. . * Teacher salary 0. . * School 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 5 5 Practical Solutions
School: Business Rules (2) Teachers and the principal are both paid a salary; the principal evaluates the teachers. n A school board supervises multiple schools and can hire or fire the principle of each school. n School Board 0. . * School 6 hire. Principal() fire. Principal() 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 6 Practical Solutions
School: Business Rules (3) n n n A school has many playgrounds and rooms. A playground has many swings. Each room has many chairs and doors. Rooms include restrooms, classrooms, and the cafeteria. Each classroom has many computers and desks. Each disk has many rulers. 7 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 7 Practical Solutions
School: Business Rules (3) School 0. . * Playground 0. . * Chair 0. . * Classroom 0. . * Computer Room Swing 0. . * Door Cafeteria Restroom 0. . * Desk 0. . * Ruler 8 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 8 Practical Solutions
File System: Business Rules (1) n A drive may have many multiple disks – A hard drive contains many disks. – A floppy drive contains one disk. n Please note that: – A drive may exist without a disk – A disk may exist without a drive 9 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 9 Practical Solutions
File System: Business Rules (2) A disk is divided into tracks which are in turn subdivided into sectors. n Please note: Tracks are part of the disk and sectors are part of the track n 10 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 10 Practical Solutions
File System: Business Rules (3) n A file system may spread on multiple disks and a disk may be partitioned across file systems. 11 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 11 Practical Solutions
File System: Business Rules (4) Similarly a disk may contain many files and a file may be partitioned across many disks n A file system consists of many files n Each file has a filename, owner, permissions for reading and writing, last modifications date, size, checksum. n Please note: Files are part of the file system. n 12 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 12 Practical Solutions
File System: Business Rules (5) Files may be data files and directory files n A directory file is associated with a directory n A file may correspond to many directories. n Data file may be an ASCII file, executable file, or both. n 13 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 13 Practical Solutions
File System’s Class Diagram Would you be able to generate the file system’s class diagram? 14 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 14 Practical Solutions
Kitchen: Business Rules (1) A room is part of a building. n A building has many rooms n A kitchen is a kind of (AKO) a room n Please not that a building is a whole and a room is a part. The rest of the business rules are very simple. Would you be able to generate the rest of the business rules and the class diagram? 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 15 15 Practical Solutions
Discussion Questions Any Question? 16 2003 SJSU – Cmp. E --- M. E. Fayad L 3 -S 16 Practical Solutions
- Slides: 16