Test the table relationships
The real benefit of relational databases becomes clear when we combine data from multiple tables. Run:
sql
SELECT
br.borrow_id,
s.student_id,
CONCAT(
s.student_first_name,
' ',
s.student_last_name
) AS student_name,
s.student_course,
b.book_id,
b.book_title,
b.book_author,
b.book_category,
br.borrow_date,
br.borrow_return_date
FROM borrow br
INNER JOIN students s
ON br.student_id = s.student_id
INNER JOIN books b
ON br.book_id = b.book_id
ORDER BY br.borrow_date DESC;
text
borrow_id | student_name | course | book_title
------------------------------------------------------------
3 | RON EDMUND | BSEE | 1984
2 | JAN XAVIER | BSA-AGRONOMY | Project Hail Mary
1 | CLIFF AMADEUS | BSIT | Jurassic Park
borrow, we use their IDs to connect the tables.
This is one of the main ideas behind a relational database.
Sign in to save your progress permanently.
Progress is saved in your browser session
Step 14 of 19