第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. JS调试技巧

    大家都有用过各种类型的浏览器,每种浏览器都有自己的特色,本人拙见,在我用过的浏览器当中,我是最喜欢Chrome的,因为它对于调试脚本及前端设计调试都有它比其它浏览器有过之而无不及的地方.可能大家对co ...

  2. Oracle表中的主键被当成哪些表的外键

    SELECT B.TABLE_NAME FROM USER_CONSTRAINTS A INNER JOIN USER_CONS_COLUMNS B ON A.CONSTRAINT_NAME = B. ...

  3. mybatis拦截器获取sql

    mybatis获取sql代码 package com.icourt.alpha.log.interceptor; import org.apache.ibatis.executor.Executor; ...

  4. Python学习笔记---切片 列表 元祖 字典 集合

    列表[1,2,3,2]#[] 元祖(1,2,3,2)#() 字典{1:2,3:2}#{} 集合{1,2,3,2}#{} 1,集合与列表的区别,集合里不能有重复元素 2.字典与集合的区别,都是用花括号表 ...

  5. c#随机生成英文名

    private static string GenerateSurname() {     string name = string.Empty;     string[] currentConson ...

  6. springmvc拦截器的简单了解

    1.定义一个拦截器 2.在springmvc.xml中配置拦截器. (1)拦截器拦截的请求是建立在前端控制器配置之下的,若DispatcherServlet拦截的是*.action,则拦截器即使配置 ...

  7. Linux Tomcat安装部署项目

    一.上传Tomcat服务器

  8. JAVA结合testng断言verify(断言失败不中断继续执行)

    原理: 1.自已构造一个断言类,把Assert.assertEquals给try catch住. 2.利用testng的监听类在测试方法运行结束后进行分析. 代码: 断言类: package com. ...

  9. 图片转base64上传,视频同理。

    body: <input type="file" id="img" type="file" onchange="up()&q ...

  10. 445. Add Two Numbers II 链表中的数字求和

    [抄题]: You are given two non-empty linked lists representing two non-negative integers. The most sign ...