数据库知识串讲 讲解数据库基础知识,只要讲解数据库mysql,文中会提到别的数据库和mysql不同 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 前期准备创建数据库employe并创建多个表前期是随便练习后边知识由浅入深前边几页是练习代码所需要的各种表里面有中文符号最好自己动手敲创建数据库CREATE DATABASE `employe` /*!40100 DEFAULT CHARACTER SET utf8 */;# Host: 28.5.8.60 (Version 5.7.17)# Date: 2019-08-29 16:51:37# Writer: 煮不烂的鸡蛋 (Build 1.26)## Structure for table "customer_tbl"#DROP TABLE IF EXISTS `customer_tbl`;CREATE TABLE `customer_tbl` ( `cust_id` varchar(10) NOT NULL DEFAULT '', `cust_name` varchar(30) NOT NULL DEFAULT '', `cust_address` varchar(20) NOT NULL DEFAULT '', `cust_city` varchar(15) NOT NULL DEFAULT '', `cust_state` char(2) NOT NULL DEFAULT '', `cust_zip` bigint(20) DEFAULT NULL, `cust_phone` char(11) DEFAULT NULL, `cust_fax` varchar(255) DEFAULT NULL, PRIMARY KEY (`cust_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;## Data for table "customer_tbl"#INSERT INTO `customer_tbl` VALUES ('090','gyui','nlkhlk','inadd','in',46224,'223323',''),('109','nanweg',' apt a4556 a','broa','in',47950,'153782',NULL),('12','hjklk','oiioh\'p','danv','il',47978,'323323','2232313213'),('232','sgah nka','798 agfhj','inadd','in',47856,'156324',NULL),('345','sadf','sadfaf','leba','in',49967,'123436',NULL);## Structure for table "employe_tbl"#DROP TABLE IF EXISTS `employe_tbl`;CREATE TABLE `employe_tbl` ( `emp_id` varchar(9) NOT NULL DEFAULT '', `last_name` varchar(15) NOT NULL DEFAULT '', `first_name` varchar(15) NOT NULL DEFAULT '', `middle_name` varchar(15) DEFAULT NULL, `address` varchar(30) NOT NULL DEFAULT '', `city` varchar(15) NOT NULL DEFAULT '', `state` char(2) NOT NULL DEFAULT '', `zip` bigint(5) NOT NULL DEFAULT '0', `phone` char(10) DEFAULT NULL, `pager` char(10) DEFAULT NULL, PRIMARY KEY (`emp_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `customer_tbl` VALUES ('090','gyui','nlkhlk','inadd','in',46224,'223323',''),('109','nanweg',' apt a4556 a','broa','in',47950,'153782',NULL),('12','hjklk','oiioh\'p','danv','il',47978,'323323','2232313213'),('232','sgah nka','798 agfhj','inadd','in',47856,'156324',NULL),('345','sadf','sadfaf','leba','in',49967,'123436',NULL);## Structure for table "employe_tbl"#DROP TABLE IF EXISTS `employe_tbl`;CREATE TABLE `employe_tbl` ( `emp_id` varchar(9) NOT NULL DEFAULT '', `last_name` varchar(15) NOT NULL DEFAULT '', `first_name` varchar(15) NOT NULL DEFAULT '', `middle_name` varchar(15) DEFAULT NULL, `address` varchar(30) NOT NULL DEFAULT '', `city` varchar(15) NOT NULL DEFAULT '', `state` char(2) NOT NULL DEFAULT '', `zip` bigint(5) NOT NULL DEFAULT '0', `phone` char(10) DEFAULT NULL, `pager` char(10) DEFAULT NULL, PRIMARY KEY (`emp_id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;## Data for table "employe_tbl"#INSERT INTO `employe_tbl` VALUES (' ## Data for table "products_tbl"#INSERT INTO `products_tbl` VALUES ('11235','wit',69.99),('13','false',1.10),('15','ass',10.00),('222','pla',7.75),('90','lig',84.50),('907','cab',1.35);## Structure for table "rich_employees"#DROP TABLE IF EXISTS `rich_employees`;CREATE TABLE `rich_employees` ( `emp_id` varchar(11) NOT NULL DEFAULT '', `last_time` varchar(255) NOT NULL DEFAULT '', `first_name` varchar(255) NOT NULL DEFAULT '', `pay_rate` decimal(4,2) NOT NULL DEFAULT '0.00') ENGINE=InnoDB DEFAULT CHARSET=utf8;## Data for table "rich_employees"#INSERT INTO `rich_employees` VALUES ('442346889','plew','tina',14.75),('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),('443679021','spurgeon','tiffany',15.00);## mysql 关于并发插入的问题 什么情况下用存储过程, 迷茫了 请教一个sql语句 SQL怎样设置一列显示是或否 c或者c++语言操作mysql,能不能建立永久连接? MYSQL 的DATEDIFF函数问题 关于DATETIME字段默认值设置 关于上传,简单!高分酬谢!请有经验的朋友帮我看看!急!谢谢! mysql数据库连接的问题!请求帮助! Mysql最新版3.30是否支持子查询? SQL 常见面试题解析 数据库讲解续
前期是随便练习后边知识由浅入深
前边几页是练习代码所需要的各种表
里面有中文符号最好自己动手敲
创建数据库
CREATE DATABASE `employe` /*!40100 DEFAULT CHARACTER SET utf8 */;
# Host: 28.5.8.60 (Version 5.7.17)
# Date: 2019-08-29 16:51:37
# Writer: 煮不烂的鸡蛋 (Build 1.26)
#
# Structure for table "customer_tbl"
#
DROP TABLE IF EXISTS `customer_tbl`;
CREATE TABLE `customer_tbl` (
`cust_id` varchar(10) NOT NULL DEFAULT '',
`cust_name` varchar(30) NOT NULL DEFAULT '',
`cust_address` varchar(20) NOT NULL DEFAULT '',
`cust_city` varchar(15) NOT NULL DEFAULT '',
`cust_state` char(2) NOT NULL DEFAULT '',
`cust_zip` bigint(20) DEFAULT NULL,
`cust_phone` char(11) DEFAULT NULL,
`cust_fax` varchar(255) DEFAULT NULL,
PRIMARY KEY (`cust_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "customer_tbl"
#INSERT INTO `customer_tbl` VALUES ('090','gyui','nlkhlk','inadd','in',46224,'223323',''),
('109','nanweg',' apt a4556 a','broa','in',47950,'153782',NULL),
('12','hjklk','oiioh\'p','danv','il',47978,'323323','2232313213'),
('232','sgah nka','798 agfhj','inadd','in',47856,'156324',NULL),
('345','sadf','sadfaf','leba','in',49967,'123436',NULL);#
# Structure for table "employe_tbl"
#DROP TABLE IF EXISTS `employe_tbl`;
CREATE TABLE `employe_tbl` (
`emp_id` varchar(9) NOT NULL DEFAULT '',
`last_name` varchar(15) NOT NULL DEFAULT '',
`first_name` varchar(15) NOT NULL DEFAULT '',
`middle_name` varchar(15) DEFAULT NULL,
`address` varchar(30) NOT NULL DEFAULT '',
`city` varchar(15) NOT NULL DEFAULT '',
`state` char(2) NOT NULL DEFAULT '',
`zip` bigint(5) NOT NULL DEFAULT '0',
`phone` char(10) DEFAULT NULL,
`pager` char(10) DEFAULT NULL,
PRIMARY KEY (`emp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `customer_tbl` VALUES ('090','gyui','nlkhlk','inadd','in',46224,'223323',''),
('109','nanweg',' apt a4556 a','broa','in',47950,'153782',NULL),
('12','hjklk','oiioh\'p','danv','il',47978,'323323','2232313213'),
('232','sgah nka','798 agfhj','inadd','in',47856,'156324',NULL),
('345','sadf','sadfaf','leba','in',49967,'123436',NULL);#
# Structure for table "employe_tbl"
#DROP TABLE IF EXISTS `employe_tbl`;
CREATE TABLE `employe_tbl` (
`emp_id` varchar(9) NOT NULL DEFAULT '',
`last_name` varchar(15) NOT NULL DEFAULT '',
`first_name` varchar(15) NOT NULL DEFAULT '',
`middle_name` varchar(15) DEFAULT NULL,
`address` varchar(30) NOT NULL DEFAULT '',
`city` varchar(15) NOT NULL DEFAULT '',
`state` char(2) NOT NULL DEFAULT '',
`zip` bigint(5) NOT NULL DEFAULT '0',
`phone` char(10) DEFAULT NULL,
`pager` char(10) DEFAULT NULL,
PRIMARY KEY (`emp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "employe_tbl"
#INSERT INTO `employe_tbl` VALUES
('
#
# Data for table "products_tbl"
#INSERT INTO `products_tbl` VALUES ('11235','wit',69.99),('13','false',1.10)
,('15','ass',10.00),('222','pla',7.75),('90','lig',84.50),('907','cab',1.35);#
# Structure for table "rich_employees"
#DROP TABLE IF EXISTS `rich_employees`;
CREATE TABLE `rich_employees` (
`emp_id` varchar(11) NOT NULL DEFAULT '',
`last_time` varchar(255) NOT NULL DEFAULT '',
`first_name` varchar(255) NOT NULL DEFAULT '',
`pay_rate` decimal(4,2) NOT NULL DEFAULT '0.00'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;#
# Data for table "rich_employees"
#INSERT INTO `rich_employees` VALUES ('442346889','plew','tina',14.75),
('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),
('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),
('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),
('443679021','spurgeon','tiffany',15.00),('442346889','plew','tina',14.75),
('443679021','spurgeon','tiffany',15.00);
#
#