logo

SQL Triggers and Stored Procedures

   

Added on  2021-04-24

9 Pages954 Words38 Views
Running head: SQL STORED PROCEDURESSQL Stored ProceduresName of the Student:Name of the University:Author Note
SQL Triggers and Stored Procedures_1
1SQL STORED PROCEDURESPart I: Entity-Relationship DiagramUserItemRatesBuysUserIDUserNamebuysprovidesMMisMM1MItemIdDescriptionCategoryPriceUserIdItemIdRatingUserIdItemIdPricePart II: SQL QueriesQuery 1SELECT `Description` FROM `item` WHERE `Category`= "Book" AND `Price` < 5The output for the query isQuery 2
SQL Triggers and Stored Procedures_2
2SQL STORED PROCEDURESSELECT item.Description FROM item JOIN buys ON item.ItemID = buys.ItemID JOIN user ONuser.UserID = buys.UserID WHERE user.UserName = "Smith" GROUP BY item.DescriptionThe output of the query isQuery 3SELECT SUM (buys.price), user.UserName FROM user Join buys on user.UserID = buys.UserIDGROUP by Buys.UserID HAVING SUM (buys.price) > 1000The output of the following query is Query 4SELECT AVG(`Price`), Category FROM `item` GROUP BY CategoryThe output of the following query isQuery 5select item.Description from item Join rate on item.ItemID = rate.ItemID where item.ItemID not in (selectItemID from rate)This query does not provide any output as there are not value as such in the database.Query 6
SQL Triggers and Stored Procedures_3

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Desklib Study Material Library: ERD Relationship, SQL Queries
|7
|1319
|264

SQL/PSQL Fundamentals - Desklib
|19
|812
|53

Entity Relationship Modelling Assignment
|17
|2659
|240

Research and SQL Queries
|11
|690
|285

Desklib SEO Suggestions
|4
|935
|496

Research and SQL Queries
|11
|831
|352