- Search Department: choose a department, the number of books "can not miss" and the number of books, "Best Sellers" with details about
assume that the choice department is made by name (R_nome). You will need 4 tables: BOOK, DEPT, CLASS, BELONGS
With this first question we get the number of books "can not miss" in a particular department:
SELECT count (*) AS [Numero_Libri]
FROM Paper, Department, Category, belongs
WHERE (
L_Reparto = R_codice
AND
C_codice = A_Categoria
AND
A_Libro = L_codice
AND
R_nome = [Department Name]
AND
C_descrizione = "Do not miss"
)
(same goes for the books "Top Sellers")
To get the details of the books (in this case we present only author and title:
SELECT L_autore, L_titolo
FROM Paper, Department, Category, belongs
WHERE (
L_Reparto = R_codice
AND
C_codice = A_Categoria
AND
A_Libro = L_codice
AND
R_nome = [Department Name]
AND
C_descrizione = "Do not miss"
)
(same goes for the books "Top Sellers")
- Orders: Orders in progress, with details of a particular user,
- with access restricted to registered users, the composition of the orders.
Access is restricted to registered users so that they can only see their orders, then we assume that during the login is stored in the user code (COD_UTENTE), the attribute O_stato the Orders table is used to find orders.
O_numero AS SELECT [N. Odin] L_autore AS [Author] L_titolo AS [Title] AS I_numero_copie [copies]
FROM Orders, Including, Book
WHERE (
I_Ordine = O_numero
AND
I_Libro = L_codice
AND
O_Utente = COD_UTENTE
AND
O_stato = "in progress"
)
0 comments:
Post a Comment