Knowee
Questions
Features
Study Tools

Consider following relationsInstructor(id, name, dept_name,salary)Teaches (id,course_id,sec_id,sem(even/odd),year)1) Find the number of instructors who teach a course in even semester of 2016.2) List the instructors who ar not teaching in CE Department

Question

Consider following relationsInstructor(id, name, dept_name,salary)Teaches (id,course_id,sec_id,sem(even/odd),year)1) Find the number of instructors who teach a course in even semester of 2016.2) List the instructors who ar not teaching in CE Department

🧐 Not the exact question you are looking for?Go ask a question

Solution

To answer these questions, we will use SQL (Structured Query Language), which is a standard language for managing data held in a relational database management system.

  1. To find the number of instructors who teach a course in the even semester of 2016, we can use the following SQL query:
SELECT COUNT(DISTINCT id) 
FROM Instructor 
WHERE id IN (
    SELECT id 
    FROM Teaches 
    WHERE sem = 'even' AND year = 2016
);

This query first selects the IDs of instructors who taught in the even semester of 2016 from the Teaches table. Then it counts the number of distinct IDs from the Instructor table, which gives us the number of instructors who taught a course in the even semester of 2016.

  1. To list the instructors who are not teaching in the CE Department, we can use the following SQL query:
SELECT name 
FROM Instructor 
WHERE dept_name != 'CE' AND id NOT IN (
    SELECT id 
    FROM Teaches 
    WHERE course_id IN (
        SELECT course_id 
        FROM Course 
        WHERE dept_name = 'CE'
    )
);

This query first selects the course IDs of courses that are in the CE department from the Course table. Then it selects the IDs of instructors who teach these courses from the Teaches table. Finally, it selects the names of instructors from the Instructor table who are not in the CE department and do not teach any of the CE courses.

This problem has been solved

Similar Questions

Select the correct answerCourse(course_id,sec_id,semester)Here the course_id,sec_id and semester are __________ and course is a _________.OptionsAttributes, RelationRelations, AttributeTuples, SetTuples, AttributesFinish ClearPrev Next (1)

Course(course_id,sec_id,semester)Here the course_id,sec_id and semester are __________ and course is a _________.OptionsRelations, AttributeTuples, SetTuples, AttributesAttributes, Relation

Choose the correct answerWhich of the following command is used to display the departments of the instructor relation?OptionsSelect * from instructor ;Select * from instructor where Dept_name = Finance;Select dept_name from instructor;Select dept_name for instructor where Name=Jackson;

Write a SELECT statement that returns the LastName and FirstName columns from the Instructors table.Return one row for each instructor that doesn’t have any courses in the Courses table. To do that, use a subquery introduced with the NOT EXISTS operator.Sort the result set by LastName and then by FirstName.

t a university, 3 courses are offered: "Programming", "Databases" and "Software Engineering".Each course is offered by a lecturer.Create for each course an instance of type COURSE (=class) using a constructor (parameters: name of the course and the lecturer).The lecturer is stored in a data member of type LECTURER (=class). The class LECTURER should have at least the data member academic_title.The courses have a maximum of 10 and a minimum of 3 course participants.The courses can be attended not only by our own students, but also by students from other universities.The class STUDENT should have at least the following data members: Matriculation numberUniversityStudents from their own university may take any course.Students from other universities may only take one course.The classes LECTURER and STUDENT should derive from the class PERSON.The class PERSON should have at least the following data members:SurnameFirst nameEmailTask: Create a program with a menu that covers the following situation:1. Registration for a course (including querying student data). Each student has a unique email, meaning there can't be two or more students with the same email in the same course.2. Output of one/all courses with data of the participants.    Please note that if there are fewer than 3 participants in a course, an additional message must be displayed - "Course will not take place".3. Output of all courses that are not fully booked yet. The output must include the number of free places, the name of the course and the academic name of the lecturer with its academic title.4. End of program: A message will be displayed stating which participants (=all data members of the class PERSON) have to be notified because your course is not taking place.If necessary (creation, search, and so on), corresponding messages are to be displayed.Permanent storage of the data is not required. The data must only be available at the runtime of the program.Use comments in the source code to document your program.

1/3

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.