Question

I need help with the next TWO SQL question

Concepts Question 1.2: Discuss what type of relationship exists between STUDENT and PROFESSOR. (Recall that relationships can be in the form of 1-1, 1-M, M:N.)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

equi join --> this join uses one common column from two table and applies 'ON' condition on that column and applies equality operator

here in student and professor table PROF_CODE is common column

so after applying equi join

it can be written as

select * from STUDENT s JOIN PROFESSOR p ON s.PROF_CODE = p.PROF_CODE

it will give you below structure

STU_CODE PROF_CODE DEPT_CODE
125869 2 6
512272 4 4
531235 2 6
553427 1 2

Natural Join is an implicit join clause based on the common columns in the two tables being joined. Common columns are columns that have the same name in both tables.

it can be written as

select * from STUDENT NATURAL JOIN PROFESSOR  

LEFT OUTER JOIN : after applying this join all columns from left table will be taken and column from right table will be null if no value is present

here

select * from STUDENT s LEFT JOIN PROFESSOR p ON s.PROF_CODE = p.PROF_CODE

STU_CODE PROF_CODE PROF_CODE DEPT_CODE

100278
128569 2 2 6
512272 4 4 4
531235 2 2 6
531268
553427 1 1 2

Right outer join after applying this join all columns from right table will be taken and column from left table will be null if no value is present..

select * from STUDENT s RIGHT JOIN PROFESSOR p ON s.PROF_CODE = p.PROF_CODE

TU_CODE PROF_CODE PROF_CODE DEPT_CODE

553427 1 2
128569 2 2 6
3 6
512272 2 4 4

Question 1.2

Here the type of relation between STUDENT and PROFESSOR is 1:M as profeesor code 2 has more than 1 student code (2)

Add a comment
Know the answer?
Add Answer to:
I need help with the next TWO SQL question Concepts Question 1.2: Discuss what type of...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • w with explanation please Pg. 02 Question Two Leaming Outcomers) Question Two 10 Marks Create a...

    w with explanation please Pg. 02 Question Two Leaming Outcomers) Question Two 10 Marks Create a SQL statement to retrieve information from a relational database Consider the relations: requested STUDENT | Student# Std-Name Address Khan Madina Muhammad Yanbu 3 Ahmad Riyadh |+| COURSE Student# Course | Course-Name 1 IT342Enterprise Systems 2 IT407Professional Issues 2 IT445DSS Write a query using the Right Outer Join to retrieve the record from the two relations. Also, construct the table displaying the output of your...

  • this is sql developer question I just need the format of how to answer question! Create...

    this is sql developer question I just need the format of how to answer question! Create sequences (2) that can be used to number the member ID and group ID values starting with 3 (since you already have 1 and 2). Write an INSERT statement that adds another row to the Groups table, make up a group name. Use the NEXTVAL pseudo column to get the value for the next group ID from the sequence that you created in #5....

  • Question 1.Write a SQL statement for each of the following questions based on the above tables...

    Question 1.Write a SQL statement for each of the following questions based on the above tables (50 Points). 1) Create “Enrollment” table. 2) Change the credits of “Database” course from 2 to 3. 3) List the course titles (not Course_No) and grades John Doe had taken. 4) Calculate average of Café Balance, and name new field as Average Balance. 5) Create a roster for “Database” course (list student ID, last name, first name, major, and status for each student enrolled...

  • I need help for SQL homework. the question: the code for part 1,2: drop table Customer;...

    I need help for SQL homework. the question: the code for part 1,2: drop table Customer; drop table Company; drop table Cruise; drop table TravelAgent; drop table Reservation; drop sequence customerID_seq; drop sequence cruiseID_seq; drop sequence travelAgentID_seq; drop sequence reservationID_seq; create table Customer( customerID number, firstName varchar2(15), lastName varchar2(15), address varchar2(30), phone number(10) not null, age number(3), Constraint Customer_PK Primary Key (customerID), constraint Customer_unique unique (firstName,lastName,phone), constraint Customer_check check(phone is not null) ); create sequence customerID_seq start with 1 increment...

  • Hello please please help !! Thank you!! Please and thank you soo much!!! Question Completion Status:...

    Hello please please help !! Thank you!! Please and thank you soo much!!! Question Completion Status: Question 10: The genetic code consists of 64 triplets of nucleotides (called codons). Each codon (with the exception of the 3 stop codons) encodes for one of the 20 amino acids used in the synthesis of proteins. This produces some redundancy in the code as most amino acids are encoded by more than one codon. One codon, AUG serves two related functions: it signals...

  • Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables...

    Topic: Inventory Manangement Part A. Database Creation Your database should have a minimum of 4 tables and include both one-to-many and many-to-many relationships. Be sure to include some numeric and/or date fields. Define all appropriate constraints, using the proper naming conventions (see Structure Notes below). Populate your database with at least 30 records in the main table(s), and whatever is needed in related tables. Submit the following: • a short description of the purpose of the database and what the...

  • I need help for part B and C 1) Create a new project in NetBeans called...

    I need help for part B and C 1) Create a new project in NetBeans called Lab6Inheritance. Add a new Java class to the project called Person. 2) The UML class diagram for Person is as follows: Person - name: String - id: int + Person( String name, int id) + getName(): String + getido: int + display(): void 3) Add fields to Person class. 4) Add the constructor and the getters to person class. 5) Add the display() method,...

  • I need help in SQL management studio please. Question: Create the same query as query 5,...

    I need help in SQL management studio please. Question: Create the same query as query 5, but only include artists if they have 'Pop' Genre. Previous question: Create a list of all composers and artists in your database. Include two columns in your record set (the names of the returned columns are in brackets): 'Composer/Artist Name' and 'Type' (which will indicate whether your results are from the composer or artist table). Order by 'Composer/Artist Name'. This is the answer for...

  • I need a response in your opinion, from this answer Q1. Any user accessing the database is more i...

    I need a response in your opinion, from this answer Q1. Any user accessing the database is more interested in quick and correct result than how a database is designed. Hence if we introduce redundancy in the table and if the performance of the query increases, then we can ignore 3NF. This is known as denormalization. In this process, a normalized table will be rejoined to have the redundancy in the table to increase the performance of the query. Denormalization...

  • Need some help I am not understanding this programming class at all. We are using Microsoft...

    Need some help I am not understanding this programming class at all. We are using Microsoft visual studio with python in console mode to complete these labs. Double-click to hide white space CIS115 Week 4 Lab Overview Title of Lab: Multiplication Table in Python Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT