Joins Using the ssh Oracle database 11g for the table selec
Joins “Using the ssh, Oracle database 11g”
* for the table:
select table_name
from User_tables;
1. List books written by author’s last name. Complete using both the where clause and the From clause. tables needed include books, bookauthor, and author
2. Narrow the same query down to books written by an author with the last name Adams. Perform the search using the author name. Complete using both the where clause and the From clause.
3. Non-equality Join: What gift will a customer who orders the book Shortest Poems receive? Use the actual book retail value to determine the gift.
Outer Join Question
4. Create an alphabetical list of all criminals, including criminal ID, name, violent offender status, parole status, and any know aliases.
---------------------------------------------------------------------------------------------------
** Please I would have the solution like this ex. add a letter
SELECT cls.criminal_id, cls.first, cls.last, cc.crime_code, cc.fine_amount
FROM criminals cls JOIN crimes cr
ON cr.criminal_id = cls.criminal_id
JOIN crime_charges cc
ON cc.crime_id = cr.crime_id
ORDER BY criminal_id, first, last, crime_code, fine_amount;
Solution
SELECT books FROM books,bookauthor, author where authorLastName=\"BC\"
SELECT books FROM books,bookauthor, author where authorLastName=\"Adams\"
SELECT customer where bookOrderered = \"Shortest Poems receive\"
SELECT cls.criminal_id, cls.first, cls.last, cc.crime_code, cc.fine_amount
FROM criminals cls JOIN crimes cr
ON cr.criminal_id = cls.criminal_id
JOIN crime_charges cc
ON cc.crime_id = cr.crime_id
ORDER BY criminal_id, first, last, crime_code, fine_amount;
