Question: Can you create a sql query that checks if the user is a customer and allow them to be able to see the last 5

Can you create a sql query that checks if the user is a customer and allow them to be able to see the last 5of his / her recent orders from the Orders table. They will be able to see storeID, productName, number of units ordered and date ordered. A customer is not allowed to see the order list of other customers.
Order ( table ) : orderNumber,customerID,storeID,productName,unitsOrdered,orderTime ( columns )
Product ( table ) : storeID,productName,numberOfUnits,pricePerUnit ( columns ) Product supply request ( table ) : requestNumber,managerID,warehouseID,storeID,productName,unitsRequested ( columns )
Productupdates ( table ) : updateNumber,managerID,storeID,productName,updatedOn ( columns )
Store ( table ) : storeID,latitude,longitude,managerID,dateEstablished ( columns )
User ( table ) : userID,name,password,latitude,longitude,type ( columns ) Warehouse ( table ) :wareHouseID,area,latitude,longitude ( columns )
( You dont have to use every table or column )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!