MySQL Join详解

2016-01-29 15:04 1 1 收藏

MySQL Join详解,MySQL Join详解

【 tulaoshi.com - MySQL 】

 

  还是先 Create table 吧

  create table emp(
  id int not null primary key,
  name varchar(10)
  );

  create table emp_dept(
  dept_id varchar(4) not null,
  emp_id int not null,
  emp_name varchar(10),
  primary key (dept_id,emp_id));

  insert into emp() values
  (1,"Dennis-1"),
  (2,"Dennis-2"),
  (3,"Dennis-3"),
  (4,"Dennis-4"),
  (5,"Dennis-5"),
  (6,"Dennis-6"),
  (7,"Dennis-7"),
  (8,"Dennis-8"),
  (9,"Dennis-9"),
  (10,"Dennis-10");

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/mysql/)

  insert into emp_dept() values
  ("R&D",1,"Dennis-1"),
  ("DEv",2,"Dennis-2"),
  ("R&D",3,"Dennis-3"),
  ("Test",4,"Dennis-4"),
  ("Test",5,"Dennis-5");


 

(本文来源于图老师网站,更多请访问https://www.tulaoshi.com/mysql/) 

来源:https://www.tulaoshi.com/n/20160129/1495189.html

延伸阅读
1、整型 MySQL数据类型 含义(有符号) tinyint(m) 1个字节 范围(-128~127)smallint(m) 2个字节 范围(-32768~32767)mediumint(m) 3个字节 范围(-8388608~8388607)int(m) 4个字节 范围(-2147483648~2147483647)bigint(m) 8个字节 范围(+-9.22*10的18次方) 取值范围如果加了unsigned,则最大值翻倍,如tinyint unsigned的取值范围...
数据库操作语句  7. 外连接——交叉查询 7.1 查询  7.2 等值连接 7.3 右外连接 7.4 左外连接 7.5 更新操作 简介: 外部连接和自联接 inner join(等值连接) 只返回两个表中联结字段相等的行 left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录 rig...
标签: SQLServer
简介: 外部连接和自联接 inner join(等值连接) 只返回两个表中联结字段相等的行 left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录 right join(右联接) 返回包括右表中的所有记录和左表中联结字段相等的记录 on 指定表间联结字段及其关系的等号 "=" 表达式, 返回 true 或 false. 当表达式返回 true 时, 则查询中...
/usr/local/mysql/bin/mysql -uroot -proot test -e "LOAD DATA INFILE '/usr/1.txt' replace INTO TABLE test FIELDS TERMINATED BY '\t' (name,address)" info: 1.txt zhangsan wuhan lishi wuhan 把1.txt文件插入到mysql数据库中 网上看了一些总结出来的资料,不知道对大家有没有用的,有用的话也就不枉费我一按按钮的一片苦心了;P ...
标签: PHP
  PHP与MySQL交互使用详解 1、创建自动连接数据库的代码,并生成一些必要的代码.我们仔细研究一下数据库的连接函数,会发现是这样的一行代码。 $link_id=@mysql_connect($hostname,$username,$password); 所以我们在include文件connect.inc中添加以下代码就可以了。connect.inc<?php$hostname='localhost'; $username='phpstar';$pa...

经验教程

231

收藏

46
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部