DBMS Project 2020
DBMS Project 2020
1|Page
New Delhi Institute of Management
Database Management Systems
Group Project
Project-B: ArtBase Company
Max Marks: 20
Following is a case study describing the data requirements for an ArtBase company, that builds a
product for art galleries and the information that galleries need to maintain.
• Galleries keep information about artists, their names (which are unique), birthplaces, age
and style of art.
• For each piece of artwork, the artist, the year it was made, its unique title, its type of art
(e.g., painting, lithograph, sculpture, photograph), and its price must be stored.
• Pieces of artwork are also classified into groups of various kinds, for example, portraits,
still lifes, works by Picasso, or works of the 19th century; a given piece may belong to
more than one group. Each group is identified by a name (like those just given) that
describes the group.
• Finally, galleries keep information about customers. For each customer, galleries keep
that person’s unique name, address, total amount of dollars spent in the gallery (very
important!), and the artists and groups of art that the customer tends to like.
Attempt the following Questions.
2|Page
c) Draw an ER diagram for this description.
3|Page
d) Create the tables as identified from the ERD and insert dummy data into it (at least 10
records in each table).
4|Page
Figure 2Table 2 Artwork_Group
5|Page
Figure 4Table 4Customers
6|Page
e) Execute the following SQL queries on the database created above in SQLite:
1. Display details of all the galleries managed by Artbase company.
SELECT * from Gallery;
7|Page
3. Display the details of all artworks whose information is available with the company.
select * from Artwork_Piece;
8|Page
5. Display the number of paintings available group wise
Select Art_Group , Art_Type,No_of_Paintings from Artwork_Group, Artwork_Piece
WHERE Artwork_Group.Title = Artwork_Piece.Title
And Art_Type = "Painting"
9|Page
7. Display the list of details of customers and the painting purchased by them.
SELECT Cust_Name,Title from Orders
10 | P a g e
9. Display the details of customers who have purchased artwork any apart from their
known interest area.
SELECT Customers.Cust_Name, Orders.Title, Customers.Liked_Group, Art_Group
from
Orders,Artwork_Group,Customers where Customers.Liked_Group !=
Artwork_Group.Art_Group
and Customers.Cust_Name = Orders.Cust_Name
AND
Artwork_Group.Title = Orders.Title
10. Display the number of paintings in the gallery for each artist.
select Artist_Name, No_of_Paintings from Artwork_Piece
11 | P a g e
11. Display the artists whose maximum paintings have been sold and the one whose
minimum paintings have been sold.
SELECT Artist_Name, Orders.Title, max(Artwork_Purchased), 'max'
FROM Orders JOIN Artwork_Piece
WHERE Orders.Title = Artwork_Piece.Title
UNION
SELECT Artist_Name, Orders.Title, min(Artwork_Purchased), 'min'
FROM Orders JOIN Artwork_Piece
WHERE Orders.Title = Artwork_Piece.Title
12. Arrange the data of the customers with most profitable customer on top.
SELECT Cust_Name, Amt_Spent_in_mn_Dollar
FROM Orders
ORDER by Amt_Spent_in_mn_Dollar DESC
12 | P a g e
13. Show the number of customers purchasing the painting of the artist who belongs to the
same city/area.
SELECT count(Orders.Cust_Name)
FROM Orders JOIN Customers JOIN Artist JOIN Artwork_Piece
WHERE Customers.Address = Artist.Birthplace AND Orders.Title =
Artwork_Piece.Title
AND Orders.Cust_Name = Customers.Cust_Name
14. Pieces of artwork are also classified into groups of various kinds, for example, portraits,
still lifes, works by Picasso, or works of the 19th century; a given piece may belong to
more than one group, give a list of all such artwork.
select Art_Group from Artwork_Group
13 | P a g e
16. Display the most popular category of artwork.
SELECT Orders.Title, max(Artwork_Purchased),Art_Type
from Orders JOIN Artwork_Piece
WHERE Orders.Title = Artwork_Piece.Title
17. Display the details of the customer who visits the gallery most often.
SELECT Cust_Name, max(Artwork_Purchased)
FROM Orders
Note: We considered customer visiting most often who buys max number of artworks.
14 | P a g e