当前位置:网站首页>MySQL insère les résultats de la requête dans une autre table
MySQL insère les résultats de la requête dans une autre table
2022-06-10 21:36:00 【Black Horse programmeur officiel】
Objectifs d'apprentissage
- Capable d'écrire unSQLDéclarations
1. Penser
Il n'y en a qu'un.goodsTableau,Nous voulons ajouter une catégorie de produits,Par exemple,:Les informations de classification des appareils mobiles,Seulement pargoodsLe tableau ne peut pas compléter l'ajout de la classification des produits,Comment ajouter des informations sur la classification des produits?
La réponse:
- Créer un tableau de classification des produits,Prends ça.goodsLes renseignements sur la classification des marchandises figurant dans le tableau sont ajoutés au tableau..
- Oui.goodsChangement du nom de la classification dans le tableau à la classification correspondante dans le tableau de la classification des marchandisesid
2. Créer un tableau de classification des produits
-- Créer un tableau de classification des produits
create table good_cates(
id int not null primary key auto_increment,
name varchar(50) not null
);
3. Prends ça.goodsClassification des marchandises dans le tableau ajouter au tableau de classification des marchandises
-- RequêtegoodsInformations sur le classement des marchandises dans le tableau
select cate_name from goods group by cate_name;
-- Insérer les résultats de la requête dansgood_catesDans le tableau
insert into good_cates(name) select cate_name from goods group by cate_name;
-- Ajouter des informations sur la classification des appareils mobiles
insert into good_cates(name) values('Appareils mobiles');
Description:
- insert into .. select .. Représentation: Insère les résultats de la requête dans le tableau spécifié,C'est - à - dire la copie de table.
4. Résumé
- Pour compléter la copie de table, vous pouvez utiliser : insert into .. select .. SQLDéclarations
边栏推荐
- Qingniao Changping campus of Peking University: can I learn UI with a high school degree?
- 用一个性能提升了666倍的小案例说明在TiDB中正确使用索引的重要性
- Standard dual airbags, starting from 48900 for butcher Chang'an Lumin
- 1、 Vulkan develops theoretical fundamentals
- CCF class a conference or journal - regression related papers
- 记录一下今天的MySQL故障
- Mba-day21 linear programming problem
- Leetcode advanced road - 169 Most elements
- C language -- 4 first-time constant
- Calculus review 1
猜你喜欢

20192407 2021-2022-2 experimental report on Experiment 8 of network and system attack and Defense Technology
![[qingniaochangping campus of Peking University] the coordinated development of vocational education and general education, will this year's high school entrance examination be easy?](/img/3a/1376593d02adf29a1c37d894dcc0fa.png)
[qingniaochangping campus of Peking University] the coordinated development of vocational education and general education, will this year's high school entrance examination be easy?

Monitoring is easy to create a "quasi ecological" pattern and empower Xinchuang to "replace"

C language -- 1 c language cognition

入行须知:运维需要懂编程吗?

标配双安全气囊,价格屠夫长安Lumin 4.89万起售

Acl2022 | bert2bert: an efficient pre training method of parameter reuse, which significantly reduces the training cost of oversized models

Meetup Preview: introduction to the new version of linkis and the application practice of DSS

Lengsuanling, a 30-year tortuous history of IPO of a domestic brand

A small case with 666 times performance improvement illustrates the importance of using indexes correctly in tidb
随机推荐
MySQL service startup failed
CCF class a conference or journal - regression related papers
01js basic null and undefined difference type conversion = = code block logical operator
[untitled] broken item
你的公司会选择开发数据中台吗?
Brute force method / adjacency table depth first directed weighted graph undirected weighted graph
Which city should I go to after I graduate from it? Which position has a high salary? Which companies have good treatment?
Cas de test app
信号与系统复习1
[qingniaochangping campus of Peking University] the coordinated development of vocational education and general education, will this year's high school entrance examination be easy?
Software definition boundary (SDP)
What is the difference between localhost and 127.0.0.1?
torch. nn. Simple understanding of parameter / / to be continued. Let me understand this paragraph
C language -- 4 first-time constant
关于type-c
C language ---2 initial knowledge of data types
Leetcode advanced road - 136 A number that appears only once
Redis缓存击穿
Redis cache penetration
[Warning] TIMESTAMP with implicit DEFAULT value is deprecated