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

JS ES new features: Introduction to extension operators

1. Spread Operator The spread operator is three d...

Analyzing the node event loop and message queue

Table of contents What is async? Why do we need a...

MySQL Optimization: Cache Optimization (Continued)

There are caches everywhere inside MySQL. When I ...

mysql-5.7.28 installation tutorial in Linux

1. Download the Linux version from the official w...

Example of implementing skeleton screen with Vue

Table of contents Skeleton screen use Vue archite...

Install MySQL 5.7.18 using rpm package under CentOS 7

I have been using MySQL recently. The article mys...

CSS Naming: BEM, scoped CSS, CSS modules and CSS-in-JS explained

The scope of css is global. As the project gets b...

MySQL optimization query_cache_limit parameter description

query_cache_limit query_cache_limit specifies the...

Understand CSS3 FlexBox elastic layout in 10 minutes

Basic Introduction Features Flexbox is a CSS disp...

How to build SFTP server and image server on Linux cloud server

First of all, you can understand the difference b...

Detailed explanation of Object.create instance usage in js

1. Create a new object using the Object.create() ...

How to unify the character set on an existing mysql database

Preface In the database, some data tables and dat...

How to periodically clean up images that are None through Jenkins

Preface In the process of continuous code deliver...

Node.js makes a simple crawler case tutorial

Preparation First, you need to download nodejs, w...