Unformatted text preview: grity constraints in SQL. View - rows are not explicitly stored, but
computed as needed from view definition
Base table - explicitly stored 2. Every manager must also be an employee.
3. The total percentage of all appointments for an employee must
be under 100%.
4. A manager must always have a higher salary than any employee
that he or she manages. 59 60 CREATE VIEW CREATE VIEW (continued) Given tables for these relations:
Students (ID, name, major)
Enrolled (ID, CourseID, grade)
(ID CREATE VIEW ActiveSailors (name, age, day) AS
SELECT S.sname, S.age, R.day
Sailors S, Reserves R
WHERE S.sid = R.sid AND S.rating > 6; Can create view:
CREATE VIEW B-Students (name, ID, CourseID) AS
SELECT S.name, S.ID, E.CourseID
Students S, Enrolled E
WHERE S.ID = E.ID AND E.grade = ‘B’; 61
61 62 Restrictions on MySQL View
Definitions DROP VIEW DROP VIEW B-Students;
B- For restrictions on MySQL view definitions, see:
http://dev.mysql.com/doc/refman/5.0/en/create- DROP VIEW ActiveSai...
View Full Document
- Fall '12
- MYSQL , Foreign key, sailors, Sid