1. MySQL view operations are only supported in new versions of the database. The advantage of view operations is that they can simplify database queries. Especially for some frequently queried data tables, we can create a view first, and then query this type of data later. table, you can directly query the view. This can also improve query efficiency.
Another advantage of views is that if you change the fields or values of the base data table, the view table will also change accordingly, so we don't have to worry about the view's data being out of sync when changing the field values of the base data.
For example: create a view and then query through the view.
create view v3 as SELECT b.sid, b.grade, c.cname
FROM grade b, course c
WHERE b.cid = c.cid
Then query to retrieve a piece of data from the view
select sid,grade,cname from v3 where sid=200410001
Wouldn't it be better to understand this, don't use joint query again to query a certain piece of data.
2. Stored procedures, this operation can make database operations more concise, and the reusability of data operations is also better reflected. Stored procedures can implement multi-table operations, and other parameters are allowed to be passed in. Please refer to the manual for specific operations.
These two SQL features can be flexibly applied in our actual development. Maybe they can change some of our unreasonable database operations in the past, making the programs we write more reasonable and easier to maintain.