首页 > 数据库 >《sql经典实例》第二版

《sql经典实例》第二版

时间:2022-09-30 15:46:42浏览次数:56  
标签:20 utf8mb4 DEFAULT sql 实例 2006 unicode 经典 NULL

1 数据表准备

创建emp表

CREATE TABLE `emp` (
  `EMPNO` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `ENAME` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `JOB` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `MGR` tinyint(4) DEFAULT NULL,
  `HIREDATE` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `SAL` tinyint(4) DEFAULT NULL,
  `COMM` tinyint(4) DEFAULT NULL,
  `DEPTNO` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`EMPNO`)
) ENGINE=InnoDB AUTO_INCREMENT=7935 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

插入数据

INSERT INTO `emp`(`EMPNO`,`ENAME`,`JOB`,`MGR`,`HIREDATE`,`SAL`,`COMM`,`DEPTNO`)
VALUE (7369,"SMITH","CLERK","7902","17-DEC-2005","800","","20"),
(7499,"ALLEN","SALESMAN","7698","20-FEB-2006","1600","300","30"),
(7521,"WARD","SALESMAN","7698","22-FEB-2006","1250","500","30"),
(7566,"JONES","MANAGER","7839","2-APR-2006","2975","","20"),
(7654,"MARTIN","SALESMAN","7698","28-SEP-2006","1250","1400","30"),
(7698,"BLAKE","MANAGER","7839","1-MAY-2006","2850","","30"),
(7782,"CLARK","MANAGER","7839","9-JUN-2006","2450","","10"),
(7788,"SCOTT","ANALYST","7566","9-DEC-2007","3000","","20"),
(7839,"KING","PRESIDENT","","17-NOV-2006","5000","","10"),
(7844,"TURNER","SALESMAN","7698","8-SEP-2006","1500","0","30"),
(7876,"ADAMS","CLERK","7788","12-JAN-2008","1100","","20"),
(7900,"JAMES","CLERK","7698","3-DEC-2006","950","","30"),
(7902,"FORD","ANALYST","7566","3-DEC-2006","3000","","20"),
(7934,"MILLER","CLERK","7782","23-JAN-2007","1300","","10")

创建dept表

CREATE TABLE `dept` (
  `DEPTNO` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `DNAME` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `LOC` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  PRIMARY KEY (`DEPTNO`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci

 

插入数据

INSERT INTO `dept`(`DEPTNO`,`DNAME`,`LOC`)
VALUE (10,"ACCOUNTING","NEW YORK"),
(20,"RESEARCH","DALLAS"),
(30,"SALES","CHICAGO"),
(40,"OPERATIONS","BOSTON")

 

标签:20,utf8mb4,DEFAULT,sql,实例,2006,unicode,经典,NULL
From: https://www.cnblogs.com/polax/p/16745084.html

相关文章

  • 经典职场说话技巧
    语言是一门艺术,也是一名技巧,但凡是在职场混的开的人都具备会说话的技巧,所以很多有能力的人也不一定能成功,但是成功的人多数都是会展示自己的才华让大家看到你的优点。在现代......
  • 工业网关如何实现MQTT、MODBUS、OPCUA、SQL、HTTP之间协议转换?
    随着工业现场总线技术以及工业物联网的蓬勃发展,不同的自动化设备往往具备多种不同的通讯协议,在实际应用中,影响了设备的数据采集与通信效率,如工业可编程控制器PLC,西门子、欧......
  • mysql循环插入分隔符分开的字符串
    CREATEDEFINER=`root`@`localhost`PROCEDURE`test`()BEGIN DECLAREi,help_topic_idINT; SETi=10469; SEThelp_topic_id=0;WHILEi<10475DOINSERTINTO`login`.t_u......
  • 【MySQL】MariaDB使用connect引擎直接访问SQLServer数据库
    场景:mariadb通过connect引擎,访问sqlserver2008中的数据。1.安装connect存储引擎如果mariadb是使用二进制包安装的话,默认已经安装了connect存储引擎否则就需要执行手......
  • SQL之过滤数据
    主要是WHERE关键字的使用,对分组前的数据进行过滤1、where子句操作符 以上有些操作是冗余的,注意并非DBMS都支持不同的写法,具体要看2、检查单个值1select2......
  • Fanuc G87侧钻固定循环指令及实例编程
    Fanuc系统车铣复合G87侧钻固定循环指令适用于FANUCOi系统或者一些兼容系统。G87指令侧面钻孔循环主要是使用动力刀具在零件圆柱面或侧面上钻孔。G87指令格式:G87X_F_Q_P_R......
  • MYSQL 列值为JSON串匹配条件查询
    这里需定位到你要查询的字段再json中的位置。比如我需要我的列值JSON格式如下:我需要匹配Tin(123456,223432)可以像下面这样写SELECTREPLACE(JSON_EXTRACT(wms_r......
  • Spring源码-createBeanInstance方法Supplier创建bean实例
    一、例子Supplier.java@FunctionalInterfacepublicinterfaceSupplier<T>{/***Getsaresult.**@returnaresult*/Tget();}......
  • SQL之排序检索数据
     ORDERBY子句必须是SELECT语句中最后一条子句1、排序数据1select2col_name3from4table_name5orderby6col_name;2、按多个列排序1select2col_name,......
  • (转载)【RocketMQ 课程笔记】18.消费者基于自定义属性实现SQL过滤
    消费者基于自定义属性实现SQL过滤在发送消息时,发送方可以自定义消息的用户属性,消费者可以利用SQL92的WHERE子句语法实现消息过滤。相比Tag过滤,消息过滤使用更加灵活,也更......