提交 d25aca71 编写于 作者: M Mars Liu

add init database

上级 4a56d7c8
{
"node_id": "mysql-2eb9e9d351e848f580b70cf9e7b93280",
"keywords": ["update"],
"keywords": [
"update"
],
"children": [],
"export": [
"update.json"
],
"keywords_must": [
["mysql", "修改"]
[
"mysql",
"修改"
]
],
"keywords_forbid": [],
"group": 1
......
......@@ -6,9 +6,9 @@
create table employee
(
id serial primary key,
name text,
dept text,
salary money
name varchar(64),
dept varchar(64),
salary decimal(12, 4)
);
```
......
......@@ -6,14 +6,14 @@ SmartMarket 公司的OA数据库中包含以下结构:
create table employee(
id serial primary key ,
name varchar(256),
dept varchar(256),
dept varchar(64),
salary decimal(12, 4)
);
create table budget(
id serial primary key ,
dept varchar(256),
amount money
dept varchar(64),
amount decimal(12, 4)
)
```
......
......@@ -6,7 +6,7 @@ Joe 想要从员工表
create table employee(
id int primary key auto_increment,
name varchar(256),
dept varchar(256),
dept varchar(64),
salary decimal(12, 4)
);
```
......
......@@ -5,7 +5,7 @@ Joe 想从员工表
```mysql
create table employee(
id int primary key auto_increment,
dept int,
dept_id int,
name varchar(256),
post varchar(16)
)
......
......@@ -5,7 +5,7 @@ Joe 想从员工表
```mysql
create table employee(
id int primary key auto_increment,
dept int,
dept_id int,
name varchar(256),
post varchar(16)
)
......
{
"node_id": "mysql-8436069c855c4f1ead7cf11a026e004b",
"keywords": ["in", "subquery", "子查询"],
"keywords": [
"in",
"subquery",
"子查询"
],
"children": [],
"export": [
"in.json"
......
......@@ -5,7 +5,7 @@ Joe 想要从员工表
```mysql
create table employee(
id int primary key auto_increment,
dept int,
dept_id int,
name varchar(256),
post varchar(16)
)
......
......@@ -6,7 +6,7 @@ Joe 打算写一个查询,根据员工表
create table employee
(
id int primary key auto_increment,
dept varchar(256),
dept varchar(64),
name varchar(256),
post varchar(16)
)
......
......@@ -14,7 +14,7 @@ create table department(
```mysql
create table employee(
id int primary key auto_increment,
dept int,
dept_id int,
name varchar(256),
post varchar(16)
)
......
{
"node_id": "mysql-7c2331eea3e84eef9464ad4d7c03e2de",
"keywords": ["right join", "右连接"],
"keywords": [
"right join",
"右连接"
],
"children": [],
"export": [
"right_join.json"
......
......@@ -14,7 +14,7 @@ create table department(
```mysql
create table employee(
id int primary key auto_increment,
dept int,
dept_id int,
name varchar(256),
post varchar(16)
)
......
......@@ -20,7 +20,7 @@ Joe 应该如何优化?
## 答案
```mysql
alter table goods add index (stock, category_id, name);
alter table goods add index (`stock-id`, category_id, name);
```
## 选项
......@@ -28,7 +28,7 @@ alter table goods add index (stock, category_id, name);
### A
```mysql
alter table goods add index (stock and category_id and name);
alter table goods add index (`stock-id` and category_id and name);
```
### B
......@@ -40,5 +40,5 @@ alter table goods add index (concat(stock, category_id, name));
### C
```mysql
alter table goods add index (stock + category_id + name);
alter table goods add index (`stock-id` + category_id + name);
```
......@@ -2219,7 +2219,11 @@
{
"配置项优化": {
"node_id": "mysql-6d4f4d7aecfb4546a8163256859562e1",
"keywords": [],
"keywords": [
"optimize",
"performance",
"configuration"
],
"children": [],
"keywords_must": [],
"keywords_forbid": [],
......@@ -2243,7 +2247,10 @@
{
"sys数据库": {
"node_id": "mysql-3d5c8647b1674de18c8348454d16fee5",
"keywords": [],
"keywords": [
"sys",
"performance"
],
"children": [],
"keywords_must": [],
"keywords_forbid": [],
......
create database goods;
create database studio;
grant all privileges on *.* to `joe`@`localhost`;
......
create table employee
(
id serial primary key,
name varchar(256),
dept varchar(256),
salary decimal(12, 4)
id serial primary key,
name varchar(256),
dept_id int,
dept varchar(256),
salary decimal(12, 4)
);
\ No newline at end of file
create table goods_category(
id int primary key auto_increment,
name varchar(64)
);
create table stock(
id int primary key auto_increment,
name varchar(256),
level int default 1,
address varchar(1024)
);
create table goods(
id int primary key auto_increment,
category_id int,
category_id int references goods_category(id),
category varchar(64),
name varchar(256),
price decimal(12, 4),
stock int,
stock_id int references stock(id),
upper_time timestamp
)
\ No newline at end of file
)
-- MySQL dump 10.13 Distrib 8.0.26, for macos11.3 (x86_64)
--
-- Host: localhost Database: goods
-- ------------------------------------------------------
-- Server version 8.0.26
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Current Database: `goods`
--
USE `goods`;
--
-- Table structure for table `bids`
--
DROP TABLE IF EXISTS `bids`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `bids` (
`id` int NOT NULL AUTO_INCREMENT,
`invitation_id` int DEFAULT NULL,
`company_id` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `bids`
--
LOCK TABLES `bids` WRITE;
/*!40000 ALTER TABLE `bids` DISABLE KEYS */;
INSERT INTO `bids` VALUES (1,1,1),(2,1,2),(3,1,3),(4,2,3),(5,2,2),(6,2,4),(7,4,3),(8,4,1),(9,3,3),(10,3,4);
/*!40000 ALTER TABLE `bids` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `book`
--
DROP TABLE IF EXISTS `book`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `book` (
`id` int NOT NULL AUTO_INCREMENT,
`title` varchar(200) NOT NULL,
`description` varchar(1000) DEFAULT '',
`price` decimal(12,4) DEFAULT NULL,
`isbn` char(16) NOT NULL,
`publish_at` date NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `idx_book_isbn` (`isbn`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `book`
--
LOCK TABLES `book` WRITE;
/*!40000 ALTER TABLE `book` DISABLE KEYS */;
INSERT INTO `book` VALUES (1,'a book title','',25.4000,'xx-xxxx-xxxx','2019-12-01'),(2,'a other book title','',25.4000,'yy-yyyy-xxxx','2019-12-01');
/*!40000 ALTER TABLE `book` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `company`
--
DROP TABLE IF EXISTS `company`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `company` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `company`
--
LOCK TABLES `company` WRITE;
/*!40000 ALTER TABLE `company` DISABLE KEYS */;
INSERT INTO `company` VALUES (1,'BAB'),(2,'DDD'),(3,'Name8'),(4,'TeamTo');
/*!40000 ALTER TABLE `company` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `customer`
--
DROP TABLE IF EXISTS `customer`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `customer` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL,
`address` varchar(1024) DEFAULT NULL,
`level` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `customer`
--
LOCK TABLES `customer` WRITE;
/*!40000 ALTER TABLE `customer` DISABLE KEYS */;
INSERT INTO `customer` VALUES (1,'Jil B. Will','Tim Build B5-101 ',1),(2,'Bill G. Gibson','777 Prop.20 Wolfframe',2),(3,'May Force','75 BS. US Tatoin Area',5),(4,'Zoe JiaJia Binks','P. F. S G.',5),(5,'David Ortiz','BOS',3),(6,'Jackie Bradley Jr.','BOS',1),(7,'Xander Bogarts','BOS',2),(8,'Mookie Betts','BOS',3),(9,'Jose Altuve','HOU',2),(10,'Will Harris','HOU',1),(11,'Max Scherzer','WSH',1),(12,'Bryce Harper','WSH',1),(13,'Daniel Murphy','WSH',1),(14,'Wilson Ramos','WSH',1);
/*!40000 ALTER TABLE `customer` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `employee`
--
DROP TABLE IF EXISTS `employee`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `employee` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL,
`dept` varchar(256) DEFAULT NULL,
`salary` decimal(12,4) DEFAULT NULL,
`address` varchar(1024) DEFAULT NULL,
`post` varchar(256) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `id` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `employee`
--
LOCK TABLES `employee` WRITE;
/*!40000 ALTER TABLE `employee` DISABLE KEYS */;
INSERT INTO `employee` VALUES (1,'mars','dev',1500.0000,'bell street 221','rd'),(2,'steve','dev',2500.0000,'kpt street 221','rd'),(3,'jone','dev',1000.0000,'wall street 793 ny','rd'),(4,'tom','hr',1000.0000,'dumpling garden 5-222-12','officer'),(5,'jam','hr',2000.0000,'lorde street 1-89','officer'),(6,'john','dev',1000.0000,'spark-343 pump street','assistant');
/*!40000 ALTER TABLE `employee` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `goods`
--
DROP TABLE IF EXISTS `goods`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `goods` (
`id` int NOT NULL AUTO_INCREMENT,
`category_id` int DEFAULT NULL,
`category` varchar(64) DEFAULT NULL,
`name` varchar(256) DEFAULT NULL,
`price` decimal(12,4) DEFAULT NULL,
`stock-id` int DEFAULT NULL,
`upper_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `goods`
--
LOCK TABLES `goods` WRITE;
/*!40000 ALTER TABLE `goods` DISABLE KEYS */;
INSERT INTO `goods` VALUES (1,1,'食品','鲮鱼罐头',10.0000,NULL,'2022-06-13 11:28:33'),(2,1,'食品','午餐肉罐头',10.0000,NULL,'2022-06-13 11:28:34'),(3,2,'服装','羊绒围巾',2000.0000,NULL,'2022-06-13 11:28:35'),(4,2,'服装','羊毛围巾',800.0000,NULL,'2022-06-13 11:28:35'),(5,2,'服装','羊绒提花围巾',1200.0000,NULL,'2022-06-13 11:28:36'),(6,6,'运动','钓鱼竿',3000.0000,NULL,'2022-06-13 11:28:36');
/*!40000 ALTER TABLE `goods` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `goods_category`
--
DROP TABLE IF EXISTS `goods_category`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `goods_category` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(64) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `goods_category`
--
LOCK TABLES `goods_category` WRITE;
/*!40000 ALTER TABLE `goods_category` DISABLE KEYS */;
INSERT INTO `goods_category` VALUES (1,'食品'),(2,'服装'),(3,'电器'),(4,'书影音'),(5,'家具'),(6,'运动');
/*!40000 ALTER TABLE `goods_category` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `invitation`
--
DROP TABLE IF EXISTS `invitation`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `invitation` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL,
`attachment` text,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `invitation`
--
LOCK TABLES `invitation` WRITE;
/*!40000 ALTER TABLE `invitation` DISABLE KEYS */;
INSERT INTO `invitation` VALUES (1,'Plan A','A project'),(2,'Plan B','An other project'),(3,'Plan X','X project'),(4,'Auto Desktop','A project about OA system with desktop GUI');
/*!40000 ALTER TABLE `invitation` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `items`
--
DROP TABLE IF EXISTS `items`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `items` (
`id` int NOT NULL AUTO_INCREMENT,
`item` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `items`
--
LOCK TABLES `items` WRITE;
/*!40000 ALTER TABLE `items` DISABLE KEYS */;
INSERT INTO `items` VALUES (1,2),(2,NULL),(3,9),(4,534214123);
/*!40000 ALTER TABLE `items` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `node`
--
DROP TABLE IF EXISTS `node`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `node` (
`id` int NOT NULL AUTO_INCREMENT,
`pid` int DEFAULT NULL,
`val` int DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `node`
--
LOCK TABLES `node` WRITE;
/*!40000 ALTER TABLE `node` DISABLE KEYS */;
INSERT INTO `node` VALUES (1,0,0),(2,1,1),(3,1,2),(4,2,4),(5,2,4),(6,1,4),(7,3,4),(8,5,4);
/*!40000 ALTER TABLE `node` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `orders`
--
DROP TABLE IF EXISTS `orders`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders` (
`id` int NOT NULL AUTO_INCREMENT,
`item_id` int DEFAULT NULL,
`amount` int DEFAULT NULL,
`unit_price` decimal(12,4) DEFAULT NULL,
`total` decimal(12,4) DEFAULT NULL,
`description` varchar(2000) DEFAULT NULL,
`ts` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `orders`
--
LOCK TABLES `orders` WRITE;
/*!40000 ALTER TABLE `orders` DISABLE KEYS */;
INSERT INTO `orders` VALUES (1,1,33,5.0000,140.2500,'','2022-05-27 15:36:01'),(3,4,9,25.0000,200.0000,NULL,'2022-06-13 12:57:10'),(4,2,55,5.0000,250.0000,NULL,'2022-06-13 12:57:32');
/*!40000 ALTER TABLE `orders` ENABLE KEYS */;
UNLOCK TABLES;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`mars`@`%`*/ /*!50003 TRIGGER `in_orders` AFTER INSERT ON `orders` FOR EACH ROW insert into orders_log(id, item_id, amount, unit_price, total, description, ts, direction)
values(NEW.id, NEW.item_id, NEW.amount, NEW.unit_price, NEW.total, NEW.description, NEW.ts, 'in') */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
/*!50003 SET @saved_cs_client = @@character_set_client */ ;
/*!50003 SET @saved_cs_results = @@character_set_results */ ;
/*!50003 SET @saved_col_connection = @@collation_connection */ ;
/*!50003 SET character_set_client = utf8mb4 */ ;
/*!50003 SET character_set_results = utf8mb4 */ ;
/*!50003 SET collation_connection = utf8mb4_0900_ai_ci */ ;
/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
/*!50003 SET sql_mode = 'ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION' */ ;
DELIMITER ;;
/*!50003 CREATE*/ /*!50017 DEFINER=`mars`@`%`*/ /*!50003 TRIGGER `out_orders` AFTER DELETE ON `orders` FOR EACH ROW insert into orders_log(id, item_id, amount, unit_price, total, description, ts, direction)
values(OLD.id, OLD.item_id, OLD.amount, OLD.unit_price, OLD.total, OLD.description, OLD.ts, 'out') */;;
DELIMITER ;
/*!50003 SET sql_mode = @saved_sql_mode */ ;
/*!50003 SET character_set_client = @saved_cs_client */ ;
/*!50003 SET character_set_results = @saved_cs_results */ ;
/*!50003 SET collation_connection = @saved_col_connection */ ;
--
-- Table structure for table `orders_log`
--
DROP TABLE IF EXISTS `orders_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `orders_log` (
`log_id` int NOT NULL AUTO_INCREMENT,
`id` int DEFAULT NULL,
`item_id` int DEFAULT NULL,
`amount` int DEFAULT NULL,
`unit_price` decimal(12,4) DEFAULT NULL,
`total` decimal(12,4) DEFAULT NULL,
`description` varchar(2000) DEFAULT NULL,
`ts` timestamp NULL DEFAULT NULL,
`direction` varchar(16) DEFAULT NULL,
`log_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `orders_log`
--
LOCK TABLES `orders_log` WRITE;
/*!40000 ALTER TABLE `orders_log` DISABLE KEYS */;
INSERT INTO `orders_log` VALUES (1,1,1,33,5.0000,140.2500,'','2022-05-27 15:36:01','in','2022-05-27 15:36:01'),(2,2,1,89,5.0000,200.2500,'','2022-05-27 15:36:16','in','2022-05-27 15:36:16'),(3,2,1,89,5.0000,200.2500,'','2022-05-27 15:36:16','out','2022-05-27 15:36:35'),(4,3,4,9,25.0000,200.0000,NULL,'2022-06-13 12:57:10','in','2022-06-13 12:57:10'),(5,4,2,55,5.0000,250.0000,NULL,'2022-06-13 12:57:32','in','2022-06-13 12:57:32');
/*!40000 ALTER TABLE `orders_log` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `payment`
--
DROP TABLE IF EXISTS `payment`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `payment` (
`payment_id` int NOT NULL AUTO_INCREMENT,
`customer_id` int DEFAULT NULL,
`staff_id` int DEFAULT NULL,
`rental_id` int DEFAULT NULL,
`amount` decimal(12,8) DEFAULT NULL,
`payment_date` timestamp NULL DEFAULT NULL,
`day` date GENERATED ALWAYS AS (cast(`payment_date` as date)) STORED,
PRIMARY KEY (`payment_id`),
KEY `idx_payment_date` ((cast(`payment_date` as date)))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `payment`
--
LOCK TABLES `payment` WRITE;
/*!40000 ALTER TABLE `payment` DISABLE KEYS */;
/*!40000 ALTER TABLE `payment` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `points`
--
DROP TABLE IF EXISTS `points`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `points` (
`id` int NOT NULL AUTO_INCREMENT,
`x` float DEFAULT NULL,
`y` float DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `points`
--
LOCK TABLES `points` WRITE;
/*!40000 ALTER TABLE `points` DISABLE KEYS */;
/*!40000 ALTER TABLE `points` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `stock`
--
DROP TABLE IF EXISTS `stock`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock` (
`id` int NOT NULL AUTO_INCREMENT,
`name` varchar(256) DEFAULT NULL,
`level` int DEFAULT '1',
`address` varchar(1024) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `stock`
--
LOCK TABLES `stock` WRITE;
/*!40000 ALTER TABLE `stock` DISABLE KEYS */;
INSERT INTO `stock` VALUES (1,'纽约旗舰店',7,'wall street 7-11'),(2,'C First',5,'Charles Street 221B '),(3,'Lodon Eye',6,'Bell Street 223 Lodon');
/*!40000 ALTER TABLE `stock` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `t8`
--
DROP TABLE IF EXISTS `t8`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `t8` (
`id` int NOT NULL AUTO_INCREMENT,
`location` geometry NOT NULL,
`description` varchar(8000) DEFAULT NULL,
`memo` text,
PRIMARY KEY (`id`),
SPATIAL KEY `geo_index` (`location`),
FULLTEXT KEY `description` (`description`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `t8`
--
LOCK TABLES `t8` WRITE;
/*!40000 ALTER TABLE `t8` DISABLE KEYS */;
/*!40000 ALTER TABLE `t8` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Temporary view structure for view `v_addresses`
--
DROP TABLE IF EXISTS `v_addresses`;
/*!50001 DROP VIEW IF EXISTS `v_addresses`*/;
SET @saved_cs_client = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `v_addresses` AS SELECT
1 AS `name`,
1 AS `address`*/;
SET character_set_client = @saved_cs_client;
--
-- Current Database: `goods`
--
USE `goods`;
--
-- Final view structure for view `v_addresses`
--
/*!50001 DROP VIEW IF EXISTS `v_addresses`*/;
/*!50001 SET @saved_cs_client = @@character_set_client */;
/*!50001 SET @saved_cs_results = @@character_set_results */;
/*!50001 SET @saved_col_connection = @@collation_connection */;
/*!50001 SET character_set_client = utf8mb4 */;
/*!50001 SET character_set_results = utf8mb4 */;
/*!50001 SET collation_connection = utf8mb4_0900_ai_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`mars`@`%` SQL SECURITY DEFINER */
/*!50001 VIEW `v_addresses` AS select `employee`.`name` AS `name`,`employee`.`address` AS `address` from `employee` union select `customer`.`name` AS `name`,`customer`.`address` AS `address` from `customer` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2022-06-15 9:49:14
......@@ -3,6 +3,6 @@ create table payment(
customer_id int,
staff_id int,
rental_id int,
amount decimal(12, 8),
amount decimal(12, 4),
payment_date timestamp
)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册