This experiment I implemented is a fund trading system.
This system is not actually operated by users, but by administrators.This system needs to implement several functions.First, you need to be able to view the information of all funds in the current market, including serial numbers, fund names, and stock prices.Second, it is necessary to generate fund transaction records, which include transaction numbers, transaction users, transaction funds, and the number of shares purchased.In addition to generating new transactions, the system should also be able to delete transactions, modify old transactions, and find transactions.Third, you need to be able to view all transaction record information.
The database ER diagram is as follows:
The relational database consists of two tables.
The first table records fund information. There are three attributes, including fund number, fund name, and fund single share price.The primary key is the fund number.Each property has a non-null limit, and all are string variables.
The second table records transaction information. There are four attributes, including transaction number, transaction user name, transaction fund number, and the number of shares traded.The primary key is the transaction number.Each property has a non-null limit, where the transaction number is an auto-incrementing primary key, which is an Int type, and the rest are string variables.
The relational database is shown below
Table 1:
Table 2:
Relational database generation code:
CREATE DATABASE 'test1';CREATE TABLE `test1`.`foundation` (`foundationid` INT NOT NULL,`foundation` VARCHAR(20) NOT NULL,`price` DOUBLE NOT NULL,PRIMARY KEY (`foundationid`));CREATE TABLE `test1`.`people` (`id` INT NOT NULL AUTO_INCREMENT,`name` VARCHAR(10) NOT NULL,`foundationid` VARCHAR(10) NOT NULL,`shares` VARCHAR(10) NOT NULL,PRIMARY KEY (`id`));
The main interface of the system is as follows:
Click on the fund market to display the information of all funds in the current market, including fund number, fund name, and fund single share price.
Clicking on the transaction record will display all the transaction information currently recorded, including the transaction number, the name of the transaction user, the fund number of the transaction, and the number of shares traded.
Click the transaction button to display the transaction window, and you can change the transaction information, including adding, deleting, modifying, and searching for transactions.
Adding the trade will require input of the user's name, fund number and number of shares purchased.After entering the information and clicking Confirm, a transaction record will be added.For example, we add a piece of transaction information, the user name is zhou, to buy the No. 3 fund and buy 400 shares.
A popup will pop up after confirmation
Go to the transaction record window to view the currently recorded transaction information and add success
Modifying a transaction is similar to adding, for example, changing the number of shares in the transaction just now to 500
Click to confirm, check the transaction record, the modification is successful
Only need to enter the user name and the purchased fund number for the deletion operation.For example, delete the transaction of user zhou's purchase of Fund No. 3:
Search by username or fund number
For example, for the following transaction records:
If you search for zhou by name, the results are as follows:
If you search for 4 by fund number, the results are as follows:
First of all, we need to know
The previous article focused o