12.17mysq代码
/*create view view_after as
select*
from t_reader
where reader_birthday between '1990-1-1' and '1999-12-31';
select *from view_after;*/
/*create view view_qinghua
as
select a.* from t_book a,t_press b
where a.press_id=b.press_id
and b.press_name='清华大学出版社';
select * from view_qinghua;*/
ALTER VIEW view_after
AS
SELECT*
FROM t_reader
WHERE reader_birthday BETWEEN "1990-1-1" AND "2009-12-31";
SELECT *FROM view_after;
DROP VIEW view_after;*/
CREATE VIEW view_basic_info AS
SELECT stu_id,stu_name,stu_sex,stu_birthday
FROM t_student;
SELECT *FROM view_basic_info
CREATE VIEW view_req_course AS
SELECT*
FROM t_course
WHERE course_type='必修课';
SELECT * FROM view_req_course;
SELECT * FROM view_optional;
CREATE VIEW view_optional AS
SELECT a.stu_name,c.* FROM
t_student a,t_score b,t_course c
WHERE a.stu_id=b.stu_id
AND a.stu_sex='女' AND c.course_type='选修课';
ALTER VIEW view_optional AS
SELECT a.stu_name,c.* FROM
t_student a,t_score b,t_course c
WHERE a.stu_id=b.stu_id
AND c.course_type='选修课';
DROP VIEW view_optional;
符攀飞
接近 3 年前
540