第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(‘ ’) #

《mysql必知必会》学习_第19章_20180809_欢的更多相关文章

  1. 《mysql必知必会》学习_第22章_20180809_欢

    第22章:使用视图,视图是虚拟的表,以表形式呈现的是你查询的结果.并不是说在数据库里面真的存在这个表,但是是真的存在这些数据. select cust_name,cust_contact from c ...

  2. 《mysql必知必会》学习_第20章_20180809_欢

    第20章:更新和删除数据 P140 update customers set_emails='elmer@fudd.com' where cust_id=10005; 更新多个列,用逗号隔开.注意被指 ...

  3. 《mysql必知必会》学习_第18章_20180807_欢

    第18章 全文本搜索 P121  #创建一个新表,对表的列进行定义,定义之后,MySQL自动维护该索引# create table productnotes ( note_id  int   NOT ...

  4. 《mysql必知必会》学习_第五章_20180730_欢

    使用的工具是wamp的Mysql. P29 select prod_name from products;  #在表products中选列prod_name,顺寻不是纯粹的随机,但是没有说明排列顺序, ...

  5. 《mysql必知必会》学习_第17章_20180807_欢

    第17章:组合查询 P114 select vend_id ,prod_id,prod_price from products where prod_price <=5 ; select ven ...

  6. 《mysql必知必会》学习_第16章_20180807_欢

    第16章:创建高级联结. P106 select concat(RTrim(vend_name),'(',RTrim(vend_country),')') as vend_title from ven ...

  7. 《mysql必知必会》学习_第15章_20180806_欢

    第15章:联结表 P98 外键:外键为某个表的一列A,同时这一列包含另一个表的主键值B(B属于A,等于或者小于的关系) P99 select vend_name,prod_name,prod_pric ...

  8. 《mysql必知必会》学习_第14章_20180806_欢

    第14章:使用子查询. 子查询是镶嵌在其他查询里面,相当其他的select查询的条件来. P91 select order_num from where prod_id='tnt2';   #检索条件 ...

  9. 《mysql必知必会》学习_第13章_20180803_欢

    第13章:分组过滤. P83 select count(*) as num_prods from products where vend_id=1003; #返回vend_id=1003的产品数目总值 ...

随机推荐

  1. Python全栈开发记录_第二篇(文件操作及三级菜单栏增删改查)

    python3文件读写操作(本篇代码大约100行) f = open(xxx.txt, "r", encoding="utf-8") 不写“r”(只读)默认是只 ...

  2. BZOJ 1257: [CQOI2007]余数之和

    1257: [CQOI2007]余数之和 Time Limit: 5 Sec  Memory Limit: 128 MB Description 给出正整数n和k,计算j(n, k)=k mod 1 ...

  3. 分布式之redis复习精讲

    看到一片不错的精简的redis文档,转载之,便于复习梳理之用 转自:https://www.cnblogs.com/rjzheng/p/9096228.html ------------------- ...

  4. shell数组的使用

    定义:  array=(1 2 3) echo ${array[0]} echo ${array[1]} echo ${array[2]} echo ${array[*]}   所有元素 echo $ ...

  5. leetcode406

    public class Solution { public int[,] ReconstructQueue(int[,] people) { ) { return new int[,] { }; } ...

  6. Django 部署(Nginx+uwsgi)

    使用 uwsgi 来部署 安装 uwsgi sudo pip install uwsgi --upgrade 使用 uwsgi 运行项目 uwsgi --http :8001 --chdir /pat ...

  7. React琐碎

    1 dangerouslySetInnerHTML 使用此属性的原因是得到一个安全的数据,生成一个仅包含唯一key——__html的对象,表明这段内容会被当成text/taint使用,它的使用方式是这 ...

  8. web和app的简单测试区别和工具介绍

    首先说一下我对Web自动化测试与CS自动化测试的认识.从宏观对比都是通过脚本自动化完成功能的验证,区别不大.Web测试更为显著的浏览器兼容性.安全,以及与Web技术相关的表单测试.链接测试等,其实都是 ...

  9. Android Studio2.0 教程从入门到精通Windows版 - 入门篇

    http://www.open-open.com/lib/view/open1468121363300.html 本文转自:深度开源(open-open.com)原文标题:Android Studio ...

  10. 前端 搜索样式 html

    原文:https://blog.csdn.net/linlinxie/article/details/77484214?utm_source=blogkpcl4 测试1: <div class= ...