Get the App
SLTechnology News&Howtos  ›  Database  › 

Advanced syntax usage of database insert

Shulou Source: shulou.com Published: 2022-05-31 18:42:20 09月30日 Update

This article mainly introduces "advanced syntax usage of database insert". In daily operation, I believe that many people have doubts about the advanced syntax usage of database insert. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "advanced syntax usage of database insert". Next, please follow the editor to study!

There is such a business requirement, which requires that the source data be inserted into different tables according to different conditions, and the source data table is updated very frequently. What should such a business requirement do? I first give the source table structure and the table structure that needs to be inserted:

Source tables that are updated frequently:

Create table people (id number,name varchar2 (20), sex char (3), address varchar2 (500))

Insert data into the source table:

Insert into people

Values (1) Zhang Cuishan, male, Wudang Mountain)

Insert into people

Values (2Jing 'Yin Su', 'female', 'Tianhawk Religion')

Insert into people

Values ('Zhang Wuji', 'male', 'Ming Jiao')

Insert into people

Values (4. 'Zhao Min', 'female', 'Royal')

Insert into people

Values (5Jing 'Zhou Zhiruo', 'female', 'Emei Mountain')

Insert into people

Values ('Cheng Kun', 'male', 'Shaolin Temple')

Commit

Query the people result, as shown in the figure:

Several table structures to be inserted:

Create table people_1 (id number,name varchar2 (20))

Create table people_2 (id number,sex char (3))

Create table people_3 (sex char 3, address varchar2 500)

The business requirement now is to ID

Tags: Data Advanced Grammar Business Database results requirements Learning Frequency more conditions structure different time help Update practical wonderful next deviation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker macOS MySQL Apple OPPO Reno