Question
Based on the tables below, answer the following questions. Pet petID petName petAge ownerID 101 April 7 201 102 Tom 3 201 103 Belly 10
Based on the tables below, answer the following questions.
Pet
petID | petName | petAge | ownerID |
101 | April | 7 | 201 |
102 | Tom | 3 | 201 |
103 | Belly | 10 | 202 |
104 | Jerry | 2 | 203 |
105 | Chewy | 4 | 0 |
Owner
ownerID | ownerName | ownerHP |
201 | Julia | 012-8673418 |
202 | Rahman | 019-6745817 |
203 | Elly | 011-9909900 |
State whether the result obtained from the following SQL statement is True or False.
Pernyataan SQL
SQL Statement
SELECT Pet.petName AS pet_name, Owner.ownerName AS pet_owner
FROM Pet
RIGHT JOIN Owner
ON Pet.ownerID = Owner.ownerID;
Output :
pet_name | pet_owner |
April | Julia |
Tom | Julia |
Belly | Rahman |
Jerry | Elly |
Chewy | Null |
Using the JOIN command, display pet name with its owner name.
A. SELECT Pet.petName, Owner.ownerName FROM Pet LEFT JOIN Owner ON Pet.ownerID = Owner.ownerID;
B. SELECT Pet.petName, Owner.ownerName FROM Pet JOIN Owner ON Pet.ownerID = Owner.ownerID;
C. SELECT Pet.petName, Owner.ownerName FROM Pet RIGHT JOIN Owner ON Pet.ownerID = Owner.ownerID;
D. SELECT Pet.petName, Owner.ownerName FROM Pet FULL JOIN Owner ON Pet.ownerID = Owner.ownerID;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started