Question: a) Write SQL commands to create the type and type body for an object type called TotalSales that represents the sales of a bookstore. The

a) Write SQL commands to create the type and type body for an object type called TotalSales that represents the sales of a bookstore. The TotalSales type should have: three attributes called 'book', 'unitPrice' and quantity with respective datatype; and one method called "getTotalSales' that returns the sales (as DECIMAL). The TotalSales type may not have subtypes. (12 marks) b) Write an SQL statement to create table BookSales that has TWO (2) attributes: salesperson Name of type varchar and SaleAmount of type TotalSales. (5 marks) c) Write an INSERT statement to enter data into table BookSales. (3 marks) d) Write a SELECT statement to display Sales PersonName and totalSales columns in BookSales table
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
