This article discusses the implementation of a database for PartyKids, an event management company. It includes tasks such as creating tables, populating data, and executing queries. The article also highlights the importance of an ER diagram and legal issues related to storing customer data.
Contribute Materials
Your contribution can guide someone’s learning journey. Share your
documents today.
Running head: DATABASE IMPLEMENTATION Database Implementation Name of the Student: Name of the University: Author Note
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
8 DATABASE IMPLEMENTATION ); GO CREATE INDEX Booking_FKIndex1 ON Booking(CustomerID); GO PRINT 'Populating the Booking table' SET IDENTITY_INSERT [dbo].[Booking] ON Insert Into Booking (BookingID, CustomerID, BookingDate, CustomerFeedback) VALUES (8, 1, '2017-11-09', 'Excellent'), (9, 2, '2017-12-24', 'It was okay'), (10, 2, '2018-04-30', 'Fine'), (11, 4, '2017-09-21', 'Excellent'), (12, 4, '2018-03-28', 'Fine'), (13, 4, '2017-09-01', 'It was okay'); SET IDENTITY_INSERT [dbo].[Booking] OFF GO 9
9 DATABASE IMPLEMENTATION Delete From Customers Where CustomerID = 3; 10 Select CustomerID, BookingID, BookingDate, CustomerFeedback From Bookings Group By CustomerID, BookingID, BookingDate, CustomerFeedback;
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
10 DATABASE IMPLEMENTATION 11 Select Customer.CustomerName, Booking.BookingDate From Customer inner join Booking on Customer.CustomerID = Booking.CustomerID Order By Booking.BookingDate DESC; 12 Select Customer.CustomerName From Customer Where Customer.CustomerID not in ( Select Customer.CustomerID From Customer inner join Booking on Customer.CustomerID = Booking.CustomerID);
13 DATABASE IMPLEMENTATION REFERENCES Customer(CustomerID) ); GO CREATE INDEX Booking_FKIndex2 ON Rents(ItemID); GO CREATE INDEX Booking_FKIndex3 ON Rents(CustomerID); GO PRINT 'Creating table Payments ...'; CREATE TABLE Payments ( PaymentID INTEGER NOT NULLIDENTITY , RentID INTEGER NOT NULL, CustomerID INTEGER NOT NULL , Amount FLOAT, PRIMARY KEY(PaymentID), FOREIGN KEY(RentID) REFERENCES Rents(RentID), FOREIGN KEY(CustomerID)
14 DATABASE IMPLEMENTATION REFERENCES Customer(CustomerID) ); GO CREATE INDEX Booking_FKIndex2 ON Payments(RentID); GO CREATE INDEX Booking_FKIndex3 ON Payments(CustomerID); GO 14 PRINT 'Populating the Customers table' SET IDENTITY_INSERT [dbo].[Customers] ON Insert Into Customers(CustomerID,CustomerName, CustomerAddress) VALUES (1, 'Cristiano Ronalado', '123 Porto street'), (2, 'Pedro Rodriguez', 'benson road'), (3, 'John Smith', '12/1 Flinders St, Melbourne 3000'), (4, 'Adil Rashid', 'BJ road'), (5, 'Michael owen', '32 centre street'),
15 DATABASE IMPLEMENTATION (6, 'Robie Fowler', '45 benton street'), (7, 'Lionel Messi', '56 avenue road'); SET IDENTITY_INSERT [dbo].[Customers] OFF GO PRINT 'Populating the Booking table' SET IDENTITY_INSERT [dbo].[Bookings] ON Insert Into Bookings (BookingID, CustomerID, BookingDate, CustomerFeedback) VALUES (8, 1, '2017-11-09', 'Excellent'), (9, 2, '2017-12-24', 'It was okay'), (10, 2, '2018-04-30', 'Fine'), (11, 4, '2017-09-21', 'Excellent'), (12, 4, '2018-03-28', 'Fine'), (13, 4, '2017-09-01', 'It was okay'); SET IDENTITY_INSERT [dbo].[Bookings] OFF GO
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser
16 DATABASE IMPLEMENTATION PRINT 'Populating the Items table' SET IDENTITY_INSERT [dbo].[Items] ON Insert Into Items (ItemID, ItemName, ItemType, Price) VALUES (1, 'cushion', 'inflatable', 10), (2, 'small plastic', 'chairs', 2), (3, 'flexible', 'others', 23); SET IDENTITY_INSERT [dbo].[Items] OFF GO PRINT 'Populating the Rents table' SET IDENTITY_INSERT [dbo].[Rents] ON Insert Into Rents (RentID, ItemID, CustomerID, NumberOfDays, Price) VALUES (1, 1, 1, 79, 12), (2, 1, 2, 87, 11), (3, 2, 4, 56, 13);
17 DATABASE IMPLEMENTATION SET IDENTITY_INSERT [dbo].[Rents] OFF GO PRINT 'Populating the Payments table' SET IDENTITY_INSERT [dbo].[Payment] ON Insert Into Payment (PaymentID, RentID, CustomerID, Amount) VALUES (1, 1, 1, 28), (2, 2, 2, 34), (3, 3, 4, 43); SET IDENTITY_INSERT [dbo].[Payment] OFF GO 15 Select Customers.CustomerName From Customers Inner Join Rents on Customers.CustomerID = Rents.CustomerID Inner Join Items On Items.ItemID = Rents.ItemID Where Items.ItemType = 'inflatable';
18 DATABASE IMPLEMENTATION 16 Select Customers.CustomerName From Customers Inner Join Rents on Customers.CustomerID = Rents.CustomerID Inner Join Items On Items.ItemID = Rents.ItemID Where Items.ItemType = 'inflatable' Or Items.ItemType ='Chairs'; 17 Select Customers.CustomerName, COUNT (Bookings.BookingDate) From Customers Inner Join Bookings on Customers.CustomerID = Bookings.CustomerID Group by Customers.CustomerName;
Secure Best Marks with AI Grader
Need help grading? Try our AI Grader for instant feedback on your assignments.
19 DATABASE IMPLEMENTATION 18 Select Customers.CustomerName, SUM (Payment.Amount) As TotalAmount From Customers Inner Join Payment on Customers.CustomerID = Payment.CustomerID Group by Customers.CustomerName;
20 DATABASE IMPLEMENTATION Task 3 19 It is very important that the ER diagram is developed before the development of the database. It provides an idea to the developer who is developing the database. In addition to this, the ER diagram also helps in the maintaining the business rules of the organization. 20 There is various type of legal issues that are to be faced if the records of the card details of the customers are organized in the system. In addition to tis, the storage of the details of the address might not bring about any legal issues, but the details of the card might have some legal issues with it.