讲解数据库基础知识,只要讲解数据库mysql,文中会提到别的数据库和mysql不同

解决方案 »

  1.   

    前期准备创建数据库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;
      

  2.   


    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 
    ('
      

  3.   


    #
    # 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);
    #