How to create a view on multiple tables in MySQL

How to create a view on multiple tables in MySQL

In MySQL, create a view on two or more base tables

Create the stu_class view on the student table and stu_info table to query the s_id number, name, and class

First, create the stu_info table and insert data into it

View the data in the table

Create the stu_class view

View View

It can be seen that the created view contains id, name and class fields

Among them, the id field corresponds to the s_id field in the student table, the name field corresponds to the name field in the student table, and the class field corresponds to the class field in the stu_info table.

You may also be interested in:
  • Detailed explanation of creating a view (CREATE VIEW) and usage restrictions in MySQL
  • Detailed explanation of the usage and differences of MySQL views and indexes
  • A brief discussion on MySql views, triggers and stored procedures
  • Detailed explanation of MySql view trigger stored procedure
  • Detailed explanation of ensuring the consistency of MySQL views (with check option)
  • Mysql database advanced usage of views, transactions, indexes, self-connections, user management example analysis
  • Django framework uses mysql view operation example
  • How to create a view in MySQL

<<:  Detailed explanation of the installation and use of Linux scheduled tasks crontabs

>>:  How to import, register and use components in batches in Vue

Recommend

Summary of new usage examples of computed in Vue3

The use of computed in vue3. Since vue3 is compat...

Vue monitoring properties and calculated properties

Table of contents 1. watch monitoring properties ...

MySQL database must know sql statements (enhanced version)

This is an enhanced version. The questions and SQ...

Problems and solutions when replacing Oracle with MySQL

Table of contents Migration Tools Application tra...

10 Underused or Misunderstood HTML Tags

Here are 10 HTML tags that are underused or misun...

docker logs - view the implementation of docker container logs

You can view the container logs through the docke...

How is a SQL statement executed in MySQL?

Table of contents 1. Analysis of MySQL architectu...

How to configure whitelist access in mysql

Steps to configure whitelist access in mysql 1. L...

How to modify the group to which a user belongs in Linux

Modify the group to which a user belongs in Linux...

Example of Vue routing listening to dynamically load the same page

Table of contents Scenario Analysis Development S...

Implementation of vue+drf+third-party sliding verification code access

Table of contents 1. Background 2. Verification p...

Docker5 full-featured harbor warehouse construction process

Harbor is an enterprise-level registry server for...

How to configure Basic Auth login authentication in Nginx

Sometimes we build a file server through nginx, w...