码迷,mamicode.com
首页 > 其他好文 > 详细

左连接环境

时间:2017-06-12 22:30:07      阅读:249      评论:0      收藏:0      [点我收藏+]

标签:address   city   tac   hook   连接   create   custom   dao   datetime   

mysql> CREATE TABLE customers
    -> (
    -> c_id    int  NOT NULL AUTO_INCREMENT,
    -> c_name  char(50)  NOT NULL,
    -> c_address char(50) NULL,
    -> c_city  char(50)  NULL,
    -> c_zip   char(10)  NULL,
    -> c_contact char(50) NULL,
    -> c_email char(255) NULL,
    -> PRIMARY KEY(c_id)
    -> );

mysql> INSERT INTO customers(c_id, c_name, c_address, c_city, c_zip, c_contact, c_email) VALUES
    -> (10001, ‘RedHook‘, ‘200 Street‘, ‘Tianjin‘, ‘300000‘, ‘LiMing‘, ‘LMing@163.com‘),
    -> (10002, ‘Stars‘, ‘333 Fromage Lane‘, ‘Dalian‘, ‘116000‘, ‘Zhangbo‘, ‘Jerry@hotmail.com‘),
    -> (10003, ‘Netbhood‘, ‘1 Sunny Place‘, ‘Qingdao‘, ‘266000‘, ‘LuoCong‘, NULL),
    -> (10004, ‘JOTO‘, ‘829 Riverside Drive‘, ‘Haikou‘, ‘570000‘, ‘YangShan‘, ‘sam@hotmail.com‘);
mysql> CREATE TABLE orders
    -> (
    -> o_num    int  NOT NULL AUTO_INCREMENT,
    -> O_date   datetime  NOT NULL,
    -> c_id     int  NOT NULL,
    -> PRIMARY  KEY(o_num)
    -> );

mysql> INSERT INTO orders(o_num, o_date, c_id) VALUES
    -> (30001, ‘2008-09-01‘, 10001),
    -> (30002, ‘2008-09-12‘, 10003),
    -> (30003, ‘2008-09-30‘, 10004),
    -> (30004, ‘2008-10-03‘, 10005),
    -> (30005, ‘2008-10-08‘, 10001);

 

 

 

 

    

 

 

 

 

 

    

左连接环境

标签:address   city   tac   hook   连接   create   custom   dao   datetime   

原文地址:http://www.cnblogs.com/pzk7788/p/6995023.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!