zoukankan      html  css  js  c++  java
  • 《mysql必知必会》学习_第19章

    第19章 插入数据

    P132

    insert into customers VALUES(NULL,'Pep E.Lapew','100 Main Street',,Los Angeles','CA','90046','USA',NULL,NULL); #customers表中刚好有9个维度(一定要对应上),9个值会对应这9个维度,维度的次序由表定义#

    insert into customers (cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country,cust_contact,cust_email) VALUES(NULL,'Pep E.Lapew','100 Main Street',,Los Angeles','CA','90046','USA',NULL,NULL); #把维度列出来,按这个顺序对应后面的值填充到新行#

    跑出来对应的结果是这样:

    insert into customers(cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country) VALUES('Pep E.Lapew','100 Main Street',‘Los Angeles','CA','90046','USA') 

    insert into customers(cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country) VALUES('Pep E.Lapew1','100 Main Street1',’Los Angeles1','CA1','90045','USA1');  #同时增加两行,维度和值一一对应#  #是的我没运行出来,不知道是不是版本的问题,还是语句出错了)

    insert into customers(cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country) VALUES('Pep E.Lapew','100 Main Street',‘Los Angeles','CA','90046','USA') 

    ,('Pep E.Lapewo','100 Main Streeto',’Los Angeleso','CAo','90045','USA');     #和上面表达的意思是一样#

     

     

    insert into customers(cust_id,cust_contact,cust_emails,cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country)

    select  cust_id,cust_contact,cust_emails,cust_name,cust_address,cust_city,cust_state,cust_zip,cust_country from custnew;

    #在custnew里面对应的这些列的数据导入到表customers中,注意这个语句没有了values(‘ ’) #

  • 相关阅读:
    SpringBoot整合Swagger-ui
    SpringBoot整合Mybatis之Annotation
    Java的四层结构dto、dao、service、controller
    spring boot 项目开发常用目录结构
    Ubuntu Docker-ce安装
    SQL,NoSQL和NewSQL
    Spring常用注解
    JAVA复习重点知识
    谷歌浏览器收藏内容备份
    网线连上显示无网络连接
  • 原文地址:https://www.cnblogs.com/qiyuanjiejie/p/9450564.html
Copyright © 2011-2022 走看看