Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
RDBMS Lab01 beginning with-database (UIU)
1. United International University (UIU),CSE
Course Code: CSI 222
Course Title: Database Management
Systems Laboratory
Trimester: Summer 2015
Lab # 1 (Beginning with database)
Fatema Tuz Zohra
Assistant Professor, Dept. of CSE
2. Beginning with database
• In this lab session, you will be able to know various things
like-
▫ what should be put into a database,
▫ how can be a database organized,
▫ how will you harmonize the real-world things with
database, etc.
• Let’s start thinking- what will you try to put into the database.
Many things! Say, you are trying to keep records of teachers,
students and staffs of a university. What will you do?
2
3. Beginning with database
• The database will be a university database,
• The tables inside that university database will be teachers,
students and staffs.
• After that, think- what records will be kept.
• The name of the records will be the columns of those tables.
• The entries into those tables will be the rows of those tables.
Records/Entries
← Name of the Records →
→
→
→
→
3
4. Beginning with database
• Now try to simulate that database- (of course hypothetically! )
▫ We are keeping records of information of a university’s
teachers, students and staffs. So, the database will be
called- UNIVERSITY database.
▫ Primarily, there will be 3 tables- TEACHERS,
STUDENTS and STAFFS.
▫ Now we will take a look at what data records we should
keep.
4
5. Beginning with database
• For teachers, what information do you really think should be
kept?
NAME
DEPARTMENT
DESIGNATION
ROOM_NO
PHONE
EMAIL
ADDRESS
JOINING_DATE etc.
5
6. Beginning with database
• For students, what information do you suggest should be
kept?
NAME
STUDENT_ID
DEPARTMENT
YEAR
SEMESTER
PHONE
E-MAIL
ADDRESS
DATE_OF_BIRTH etc.
6
7. Beginning with database
• For staffs, we require at least this information-
NAME
DEPARTMENT
DESIGNATION
OFFICE_ROOM
PHONE
E-MAIL
ADDRESS
JOINING_DATE etc.
• So, it’s obvious now- we have these columns in three tables
respectively.
7
8. THINK MORE
• Now think one thing- student names can be the same, but
they are distinguishable by their ID numbers. Is there
anything for other two tables? How can you distinguish two
teachers or two staffs with the same name?
• As a remedy, we can introduce two new information-
TEACHER_ID in Teachers table and
STAFF_ID in Staffs table.
• These IDs are unique; no same ID is allocated to two different
entries.
8
9. THINK MORE
• Another thing- take a look at the size of the tables- Huge, or
short? When we insert data into the tables, some info may
type twice or more! That is quite cumbersome job! So, we
need to minimize tables on the basis of redundant column.
(We will find the benefits of minimizing tables in the later lab
classes.)
• We would like to separate the tables in following way-
Separate information on departments (DEPARTMENT)
from others.
Separate contact related info (ADDRESS, PHONE,
EMAIL) from others.
9
10. THINK MORE
• Another thing- take a look at the size of the tables- Huge, or
short? When we insert data into the tables, some info may
type twice or more! That is quite cumbersome job! So, we
need to minimize tables on the basis of redundant column.
(We will find the benefits of minimizing tables in the later lab
classes.)
• We would like to separate the tables in following way-
Separate information on departments (DEPARTMENT)
from others.
Separate contact related info (ADDRESS, PHONE,
EMAIL) from others.
10
11. THINK MORE
• In a word- what we are trying to do is splitting up tables with
small number of columns.
• Up to this point, we have tables with columns as follows-
Teachers (TEACHER_ID, NAME)
Students (STUDENT_ID, NAME)
Staffs (STAFF_ID, NAME)
Departments(ID, DEPARTMENT)
Contacts(ID, ADDRESS, PHONE,EMAIL)
11
12. THINK MORE
• Still there are options to make more tables like-
Designations (ID, DESIGNATION)
Dates (ID, JOINING_DATE, DATE_OF_BIRTH)
Year_Semester_Records (ID, YEAR, SEMESTER)
Rooms (ID, ROOM_NO)
• Do you notice that- in all of our tables we have that unique
identifier- ID!
• So far, we made 9 tables from 3 tables! But 5 tables feel
better.
• REMEMBER- Database can work even with a bad (worse/
worst) database design. But you will have to code less if you
design a database effectively!
12
13. A SIMPLE CASE STUDY
• A database is required to keep a software company’s records.
• The database should keep personal records about employee’s
like-
NAME
POST
DATE_OF_BIRTH
JOINING_DATE
YEAR_OF_EXPERIENCE
PHONE
E_MAIL
ADDRESS
GENDER
PROJECTS_COVERED etc.
13
14. A SIMPLE CASE STUDY
• The database also should contain records of
clients. Clients can be a company or
individual.
NAME_OF_COMPANY
REGISTRATION_NO
ADDRESS
WEB
EMAIL
PHONE
FAX
PROJECTS_SUPPLIED
TOTAL_COST
AMOUNT_PAID
AMOUNT_RECEIVABLE etc.
14
15. A SIMPLE CASE STUDY
• So, you decide if there should be two tables OR
more OR just one will do the job.
• Your task is to just design it effectively on your
own.
15