Advertisement
kadyr

Untitled

Dec 17th, 2021
1,496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.85 KB | None | 0 0
  1. create view bibl_fond as select b_name, a_name, g_name from books join m2m_book_authors on books.b_id = m2m_book_authors.b_id join authors on m2m_book_authors.a_id = authors.a_id join m2m_book_genres on books.b_id = m2m_book_genres.b_id join genres on m2m_book_genres.g_id = genres.g_id;
  2. use Libary_karagishiev_4216;
  3. create view reader_books as select s_id, s_name , b_name, sb_start, sb_finish from
  4.  subscriptions join subscribers on subscriptions.sb_subscriber = subscribers.s_id
  5.  join books on books.b_id = subscriptions.sb_book;
  6.  
  7. use Libary_karagishiev_4216;
  8. create view genres_authors as select distinct a_name, g_name from authors
  9. join m2m_book_authors on authors.a_id = m2m_book_authors.a_id
  10. join books on books.b_id = m2m_book_authors.b_id
  11. join m2m_book_genres on books.b_id = m2m_book_genres.b_id
  12. join genres on genres.g_id = m2m_book_genres.g_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement