I have two questions regarding sql server based on the er diagram in the link ht
ID: 3560478 • Letter: I
Question
I have two questions regarding sql server based on the er diagram in the link
http://creately.com/diagram/example/hy60eqqt1/Final%2Bdraft
1) so far from the er diagram above, if you click on the link, we made seperate tables for books and publishers, now the questions is how do we connect books to publisher, for example each book has one publisher. What is the code for that using sql server 2008.
2) in the er diagram, fiction and non fiction inherits everything from books, so how do we code that in the sql server 2008.
Explanation / Answer
example of sql code:
SELECT DISTINCT coauthors.name
FROM Author a, Wrote w, Wrote coauthorsWrote, Author coauthors
WHERE a.name = 'Ullman'
AND a.ssn = w.ssn
AND w.isbn = coauthorsWrote.isbn
AND coauthorsWrote.ssn = coauthors.ssn;
2) u have to use inner join in sql command for inheritance :)
example :
select s.*, p.* from students s inner join people p on s.personID = p.personID