Professional Documents
Culture Documents
LinkedinMoodleDatabase Report
LinkedinMoodleDatabase Report
BİLGİSAYAR MÜHENDİSLİĞİ
DATABASE MANAGEMENT
FEBRUARY - 2022
PROJECT
02.02.2022
Introduction
The aim of this project is to design and implement a relational database for
LinkedinMoodle platform. The "LinkedinMoodle" database project is considered as a
combination of the applications of LinkedIn, the career platform, and Moodle, the
education platform. Users can share their professional career profiles and get courses,
mentors etc. The LİnkedinMoodle database design makes it possible for users to get
courses, mentor services and share them on their profiles like their other social and
professional career activities.
1. ANALYSIS
1-) Write a brief explanation using your own words (in English) about these applications in
terms of their scope.
LINKEDIN
LinkedIn: is a social networking site designed for professional use by employees, job
seekers and employers. At the same time, it is a platform to easily communicate with peer
groups and make friends easily. LinkedIn provides job postings that can be accessed
easily and in the most professional way and applications can be made. LinkedIn also
provides, sharing presentations, files, and many books, and to advertise the blogs written
in an effortless way. At the same time, it promises to easily reach people in its professional
networks by sharing people's talents, achievements, awards, and many other things with
the added CV section. The more people you add to your network on the site, the faster you
can catch opportunities and increase your chances by reaching more people. Thanks to all
these features, LinkedIn is in a rapidly growing network position. The most important
reason for its rapid growth is that it provides professionals around the world with the
opportunity to establish a real and effective communication network and network
development.
MOODLE
Moodle: It is a free, open source, object-oriented, dynamic distance education system.
Moodle is used by lecturers and students. Lecturers: They can open the courses they
teach in the Moodle system, and can announce the documents, projects and grades of the
students registered for the course. Students, on the other hand, can register for these
courses given by the lecturers, access the documents shared by the lecturers, and upload
their homework related to the course to the system. Moodle is widely used in education
systems as an easy and useful system in terms of providing faster access to information
and sharing.
LinkedIn: LinkedIn is a site where users' career resumes are kept. Users can share their
talents, patents, courses, and projects they have attended, awards they have received,
exam results, languages they know, and organizations they have attended in their profiles.
They can create a detailed CV and present their work experience, education information,
licenses and certificates to employers and other users. In addition, it can offer the
opportunity to establish a real and effective communication network with companies and
people around the world, and to develop a network.
Moodle: Moodle is an educational platform that enables trainers, mentors, and students to
share knowledge.
LinkedInMoodle
COMPANY: The information of the companies registered in the system is kept in the
COMPANY table. The attributes of this entity are: "Company_id" is company
specific company number, "Company_name" is company name, "Sector" is for
company's sector.
LOCATION: The location and location information of the companies registered in the
system is kept in the LOCATION table. The attributes of this entity are:
"Company_number" is the company-specific company number, "Country" is the
country where the company is located, "City" is the city where the company is located,
"Address" is the full address of the company, "Address_code" is the address code of the
company, "District " is for the district where the company is located, "Post_code" is for the
postal code where the company is located.
POSITION: The positions of the people added to the system in the companies are kept in
the POSITION table. Attributes of this entity are: “Position_code” is for specific code of the
position, “Title” is for position’s name, “Company_id” is for company’s code number.
POSITION_HISTORY: The previous positions of the people added to the request are kept
in the POSITION_HISTORY table. The attributes of this entity are: “Person_id” is for the
personal number of the employee, “Start_date” is for the start date of the job, “Finish_date”
is for the end date of the job, “Ph_code” is for the specific code of the past position, “Title”
is for the position name, “ps_code” is for the specific position of the position for the code.
FOLLOW: The people followed by the people in the system are kept in the FOLLOW
table. Attributes of this entity are: “Follower_number” is for follower user’s specific
number, “Followed_number” is for followed user’s specific number and “Follow_date” is
for following date.
JOB_APPLY: Job posting applications are kept in the JOB APPLICATION table. The
attributes of this entity are: "Jo_id" is for the job posting's unique code number, "Person_id"
is for the job applicant's unique application code number, "Application_date" is the time the
applicant applied for the job, and "Cv" is for the applicant's CV.
JOB_OFFER: Job postings added to the system and the properties of these postings are
kept in the JOB_OFFER table. The attributes of this entity are: "Offerpost_id" is for the job
posting specific code number, "Member_id" is for the job poster specific number,
"Shared_date" is for the job posting date, "End_date" is for the job posting date, "Sector" is
for which sector it is, "Type" is for job type (internship, full-time, part-time, remote).
DIRECT_MESSAGE: The messages of the people in the system are kept in the
DIRECT_MESSAGE table. The attributes of this entity are: "Code" is for the specific
message code number, "Sender_number" is for the code number of the person sending
the message, "Recipient_number" is for the code number of the person receiving the
message, "Content" is for the text. the content of the direct message, the “date” is for the
date the message was sent.
POST: The posts shared by the people in the system and the information of these posts
are kept in the POST table. The attributes of this entity are: "Post_id" for the post's unique
code number, "Person_id" for the person number of the person who posted the post,
"Total_like" for the total number of likes for the post, "Total_comment" for the number total
number of comments on the post, "Title " is for the type of post (image, text, video), "date"
is for the post's publication date, and "Shared_hour" is for the post's publication time.
POST_COMMENT: The comments made to the posts shared by people in the system are
kept in the POST_COMMENT table. The attributes of this entity are: "Comment_id" is for
the specific code number of the comment, "Person_id" is for the person number of the
commenter, "Content" is for the text content of the comment, "Comment_date" is for the
post's publication date.
SKILL: The abilities of the people in the system and the levels of these abilities are kept in
the SKILLS table. The attributes of this entity are: “Skill_name” is for the name of the skill,
“Person_id” is for the employee with some skill and “Field” is for the skill field of the
employee.
SAVED_JOB: Jobs saved by people in the system are kept in the SAVED_JOB table. The
attributes of this entity are: "Sj_id" is for the specific code number of the job posting,
"Person_id" is for the number of the employee who registered the job posting,
"Shared_date" is for the date it is posted, "Brief" is for the information of the job it has
registered, "Level" is for the level of the job it has registered, "Type " is for the type of job it
has registered, "Offerpost_id" is for the posting of the job it has registered.
INTEREST: In the system, the areas that people are interested in are kept in the
INTEREST table. The attributes of this entity are: "Person_id" is for employees who are
interested in some field, "Relevance_name" is for name of interest and "Field" is for
employee interest.
COURSE: Course general information of each course opened in the system is kept in the
COURSE table. The properties of this entity are: “Course_number” is for the specific code
number of the course, “Course_name” is for the name of the course, “Credit” is for the
credit number of the course.
COURSE_SECTION: Each course opened in the system also has sessions. Information
about these sessions is kept in the COURSE_SECTION table. The attributes of this entity
are as follows: "course_number" is the code number specific to the course section,
"Section_id" is the code number specific to the section, "Instructor_id" is the specific
number of the department lecturer, "Year" is the year the course is given, "Semester" is the
term for the course.
CURRENT_COURSE: The current course information of the students kept in the system is
kept in the CURRENT_COURSE table. Properties of this entity: "Student_id" is the student
number of the student who took the course, "Section_id" is the special code number of the
course, "Currentcourse_id" is the special current code.
STUDENT: Student contact information of students registered in the system is kept in the
STUDENT table. The attributes of this entity are: “Student_id” is for the student’s unique
number, “University” is for the student’s university, “Department” is for the student’s
department, “Faculty” is for the student’s faculty. , "Instructor_id" is for the mentor id of the
student.
PROJECT_INSTRUCTOR: The projects shared by the instructors in the system and the
information about the projects are kept in the PROJECT_INSTRUCTOR table. Properties
of this entity: “Name” is the project name, “Task_id” is the project specific code number,
“Instructor_id” is the instructor number of the project, “Start_date” is the project start date. ,
“End_date” is for project delivery date information, “Brief” is for content of the project.
PROJECT_STUDENT: The projects that students add to the system and information about
the projects are kept in the PROJECT_STUDENT table. "Student_id" is the school number
of the owner of the project, "task_id" is the project specific code number, "Upload_date" is
for the upload date of the project, "Document_info" is for the content of the uploaded
project, "ps_id" is the special code of the uploaded project.
SOCIAL_EVENT: Events added to the system and information about the events are kept
in the SOCIAL_EVENT table. "Se_id" is for the special code of the event, "Title" is for the
name of the event, "Start_date" is for the start date of the event, "End_date" is for the end
date of the event, "Member_id" is the code of the member who made the event.
PERSON: Personnel registered in the system and information about personnel are kept in
the PERSON table. "person_id" is the special code of the person, "fname" is the person's
first name, "mname" is the person's middle name, "lname" is the person's last name,
"birth_date" is the person's date of birth, "sex" is the person's gender, "phone" is the
personun is for phone number, "type" is for what type of person the person is.
COMMENT_LIKE : Information about the likes posted to the comments in the system is
kept in the COMMENT_LIKE table. "comment_id" is the special code of the comment,
"person_id" is the special number of the person who liked the comment, "date" is the date
the person liked the comment.
POST_LIKE : Information about the likes sent to the posts in the system is kept in the
LIKE table. "post_id" is the special code of the post liked, "person_id" is the special
number of the person who liked the post, "date" is the date the post was liked.
JOIN : The information of who participated in the events in the system is kept in the JOIN
table. "se_id" is for the unique code of the event, "person_id" is the unique number of the
person participating in the event.
LinkedInMoodle Relationships
A LinkedInMoodle user can also be a student, instructor, or mentor in the system. Users
can work in more than one company. Users can be interested in some fields. Users apply
or offer a job, connect with other users, send messages to other users, comment to other
users’ posts and share posts. Users have skills. Users can organize some events. Users
can be participant of some events. Users can save job postings. Users can receive some
certificates.
Course_Section.course_number Course.course_number
Project_Student.task_id Project_Instructor.task_id
SAVED_JOB.offerpost_id JOB_OFFER.offerpost_id
POSITION_HISTORY.ps_code POSITION.ps_code
POST_COMMENT.post_id POST.post_id
PERSON.person_id MEMBER.member_id
COMPANY.company_id MEMBER.member_id
INTEREST.person_id PERSON.person_id
SKILL.person_id PERSON.person_id
SAVED_JOB.person_id PERSON.person_id
JOB_OFFER.member_id MEMBER.member_id
POST_COMMENT.person_id PERSON.person_id
POST.person_id PERSON.person_id
SOCIAL_EVENT.member_id MEMBER.member_id
POSITION_HISTORY.person_id PERSON.person_id
POSITION.company_id COMPANY.company_id
JOB_APPLY.person_id PERSON.person_id
JOB_APPLY.jo_id JOB_OFFER.jo_id
FOLLOW.follower_id PERSON.person_id
FOLLOW.followed_id PERSON.person_id
DIRECT_MESSAGE.Recipient_number PERSON.person_id
DIRECT_MESSAGE.sender_id PERSON.person_id
COMMENT_LIKE.comment_id POST_COMMENT.comment_id
COMMENT_LIKE.person_id PERSON.person_id
LIKE.post_id POST.post_id
LIKE.person_id PERSON.person_id
JOIN.se_id SOCIAL_EVENT.se_id
JOIN.person_id PERSON.person_id
LOCATION.company_id COMPANY.company_id
STUDENT.student_id PERSON.person_id
OTHER.other_id PERSON.person_id
INSTRUCTOR.instructor_id PERSON.person_id
COURSE_SECTION.instructor_id INSTRUCTOR.instructor_id
STUDENT.instructor_id INSTRCUTOR.instructor_id
PROJECT_INSTRUCTOR.instructor_id INSTRUCTOR.instructor_id
PROJECT_STUDENT.student_id STUDENT.student_id
CURRENT_COURSE.student_id STUDENT.student_id
CURRENT_COURSE.section_id COURSE_SECTION.section_id
3-Create an EER diagram for the virtually integrated version of the applications,
LinkedinMoodle. Try to use enhanced/extended features of ER modeling. Do not use any tool.
You can use any drawing application with the right legend for ER modeling. The output of
this step is just an EER diagram for LinkedinMoodle.
4-Convert EER diagram into relational model using the methodology that will be introduced
in your course.
1.Iteration
1- Regular entity
Course(course_number, course_name, credit)
Course_Section(section_id,year,semester)
Project_Instructor(task_id,brief,start_date,end_date,project_name)
Project_Student(upload_date,document_info)
Job_Offer(offerpost_id, shared_date, end_date, title_ sector)
Saved_Job(sj_id, shared_date,end_date,brief, level_type)
Post_Comment(comment_id, date, content)
Post(post_id, post_type, title, post_date, total_comment, total_like)
Social_Event(se_id, title, start_date, end_date)
Position_History(ph_code, title, start_date, end_date)
Position(ps_code, title)
2-Weak entity
--
3- 1-1 relations
--
4- 1-N relations
Course_Section(----------, course_number) #Secs
Project_Student(----------, task_id) # Has
Saved_Job(----------, offerpost_id)# Part_of
Position_History(---------, ps_code)#Has
Post_Comment(----------,post_id)#Include
5- N-N relations
--
6- Multivalued attributes
--
7- N-ary relations
--
8- disjoint- overlapping
A- System_Member(member_id, mail, password, type, joined_date)
Person(person_id, fname, mname, lname, birth_date, sex,
phone,no_of_connections)
Company(company_id, name, sector)
9- Union
--
2.Iteration
1-
--
2- Interest(member_id, interest_name, interest_field)
Skill(member_id, skill_name, skill_field)
3-
--
4-
Saved_Job(---------, person_id)#Saved
Job_Offer(----------, member_id)#Share
Post_Comment(---------, person_id)#Make
Post(-----------, person_id)#Share
Social_Event(-----------,member_id)#Create
Position_History(----------, person_id)#Has
Position(-----------,company_id)#Work_For
5-
Job_Apply(person_id, jo_id, date, cv)
Follow(follower_id, followed_id, date)
Direct_Message(sender_id, recipient_id, content, date)
Comment_Like(comment_id, person_id, date)
Like(post_id, person_id, date)
Join(joinevent_id, se_id, person_id)
6-
Location(company_id, address_code, country, city, district, adres, post_code)
7-
--
8-
A-) Person(---------,type)
Student(student_id, department, faculty, university)
Other(other_id)
Instructor(instructor_id, title, department, faculty, university)
9-
--
3.Iteration
1-
--
2-
--
3-
--
4- Course_Section(---------,instructor_id)#Teaches
Student(---------, instructor_id)#Mentor
Project_Instructor(---------, instructor_id)#Share
Project_Student(---------, student_id) #Upload
6-
--
7-
--
8-
--
9-
--
Course
Course_number Course_name credit
Course_section
Section_id Course_id Year semester
Project_Instructor
Task_id Brief Start_date End_date Project_name İnstructor_id
Project_student
Upload_date Document_info Task_id Student_id
Job_Offer
Offerpost_id Shared_date End_date Title Sector Member_id
Saved_job
Sj_id Shared_date End_date Brief Level Type Offerpost_id Person_id
Post_comment
Comment_id Date Comment_cont Person_id Post_id Comment_like
ent
Post
Post_id Post_type Title Date Total_com Total_like Person_id
ment
Social_Event
Se_id Title Sart_date End_date Member_id
Position_History
Ph_code Title Start_date End_date Ps_code Person_id Company_id
Position
Ps_code Title Company_id
System_member
Member_id Mail Password Type Joined_date
Person
Person_i Fname Mname Lname Birth_dat Sex Phone type connecti
d e ons
Company
Company_id Name sector No_of_employees
Interest
Person_id İnterest_name field
Skill
Company_id Skill_name Skill_field
Job_Apply
Person_id Jo_id Date cv
Follow
Follower_id Followed_id date
Direct_Message
Sender_id Receiver_id Content date Dm_id
C_LIKE
Comment_id Person_id date
LIKE
Post_id Person_id date Like_id
JOIN
Se_id Person_id Joinevent_id
Location
Company_id Adress_code Country City District Adres Post_code
Student
Student_id Department Faculty University İnstructor_id
Other
Other_id
Instructor
İnstructor_id Title Department Faculty university
Current_course
Student_id Section_id Currentcourse_id
5-Write down the appropriate SQL scripts (DDL statements) for creating the database and its
relational model. You can select any of the DBMS you wish.
6-Populate the database you just created again using SQL script file loaded with sample
tuples. (The tables should have enough number of tuples for the SELECT statements to be
run accordingly.)
INSERTS
DELIMITER $$
CREATE TRIGGER total_likes_update
AFTER INSERT
ON LinkedinMoodleSchema.post_like FOR EACH ROW
BEGIN
UPDATE LinkedinMoodleSchema.post
SET total_likes = total_likes + 1 WHERE
post_id = NEW.post_id ;
END$$
DELIMITER ;
----------------------------------------------------
If you have commented on someone's post, below is the trigger that will increase the number
of comments one by one.
DELIMITER $$
CREATE TRIGGER total_comments_update
AFTER INSERT
ON LinkedinMoodleSchema.post_comment FOR EACH ROW
BEGIN
UPDATE LinkedinMoodleSchema.post
SET total_comments = total_comments + 1 WHERE
post_id = NEW.post_id ;
END$$
DELIMITER ;
-----------------------------------------------------
Below is the trigger that will increase the likes of any post's comments one by one.
DELIMITER $$
CREATE TRIGGER total_comment_likes_update
AFTER INSERT
ON LinkedinMoodleSchema.comment_like FOR EACH ROW
BEGIN
UPDATE LinkedinMoodleSchema.post_comment
SET comment_likes = comment_likes + 1 WHERE
comment_id = NEW.comment_id ;
END$$
DELIMITER ;
-----------------------------------------------------
Below is the trigger that increases the total number of employees one by one when an
employee enters any company.
DELIMITER $$
CREATE TRIGGER no_of_employees_update
AFTER INSERT
ON LinkedinMoodleSchema.position_history FOR EACH ROW
BEGIN
UPDATE LinkedinMoodleSchema.company
SET no_of_employees = no_of_employees + 1 WHERE
company_id = NEW.company_id ;
END$$
DELIMITER ;
-----------------------------------------------------
Below is the trigger that keeps the total number of contacts when any user connects with
another user.
DELIMITER $$
CREATE TRIGGER no_of_connections_update
AFTER INSERT
ON LinkedinMoodleSchema.follow FOR EACH ROW
BEGIN
UPDATE LinkedinMoodleSchema.person
SET no_of_connections = no_of_connections + 1
WHERE NEW.followed_id = person_id ;
END$$
DELIMITER ;
-----------------------------------------------------
8-Write down 3 check constraints and 3 assertions. Check constraints and assertions should
be meaninful.
The process of updating the information of any student in the system is as follows.
update student
set department = 'Faculty of Engineering'
where student_number = 41;
/***********************************************************/
The process of updating the information of any company in the system is as follows.
update company
set no_of_employees = 3
where company_id = 41;
The process of deleting the information of any company from the system is as follows.
delete from company
where company_id = 41;
The query listing the names and dates of the events organized
by the organizer number 15 is as follows.
SELECT event_title, start_date, end_date
FROM social_event
WHERE organizator_member_id = 15;
ii. 4 of them should use minimum 2 tables.
The query that lists the first name information of users who are
interested in Tarkovsky movies and electric vehicles is as follows.
select distinct person.person_id ,person.fname
from person
inner join interest on interest.person_id =
person.person_id
where interest_name = 'Tarkovski' or interest_name =
'Electric Cars';
The query that lists the total number of users who have worked in
companies with locations in the United States is as follows.
select sum(no_of_employees)
from company, company_location
where company.company_id =
company_location.company_id and
company_location.country = 'United States';
The query that gives the name of the university to which the
mentors of the students studying at Ege University are affiliated,
together with the student names, is as follows.
select person.fname, instructor.university
from student, person, instructor
where student.university = 'Ege University' and
student.student_number = person.person_id and
student.mentor_id = instructor.instructor_id ;
The query that lists the talent information of users who have
worked in the Software Development sector is as follows.
select distinct person.person_id, skill.skill_name
from person, skill, company, position_history
where position_history.company_id =
company.company_id and company.sector =
'Software Development';
The query that lists the company information of kayla stewart is as
follows.
SELECT company_name, company.company_id
FROM person, company, position_history
WHERE person.fname = 'Kyla' AND person.lname = 'Stewart'
AND person.person_id = position_history.person_id AND
position_history.company_id = company.company_id;
c. Write 5 original SELECT statements that you think critical to interaction and
integration points for the database.
The query that lists the students who took the History of Economics course is
as follows.
select person.fname, person.mname, person.lname,
course.course_name
from student, person, course, course_section
where student.student_number = person.person_id and
course_section.course_id = course.course_id and
course.course_name = 'History of Economics';
The query listing the position history of the person with an ID of 27 and the
companies he worked for is as follows.
select person.person_id, company.company_id,
company.company_name, position.position_title
from person, position, position_history, company
where person.person_id = 27 and position_history.person_id =
person.person_id and position_history.company_id = com-
pany.company_id and position_history.position_id = posi-
tion.position_code;
The query listing the positions and CV codes of the person with an ID of 15
applied for job applications is as follows.
The query that lists the instructor and project description of the project
uploaded to the system by the user with ID 6 is as follows.