- let's diagram this: CREATE VIEW db_grades AS SELECT assignment_score.studentid, score, max_score, score/max_score AS percentage from assignment_score, assignment, class_assignment WHERE assignment.id = assignment_score.assignmentid AND assignment.id = class_assignment.assignmentid AND class_assignment.classid = 9 ORDER BY assignment.id;
- Large select statements can be created as views to simplify the lives of your end users (and you!)
- the midterm's problem of multiple quantities, solved semi-permanently:
CREATE VIEW quant AS SELECT SUM(quantity) AS quantity FROM diecast_car UNION SELECT SUM(quantity) AS quantity from diecast_order;
SELECT SUM(quantity) from quant;
this query is now available to all users who have permission to see it.
this particular view is non-updateable, because it contains the product of mathematical functions
NEXT
PREVIOUS
Master Index