create a database name "bank_management" by
create database bank_management;
create a table name "users"
create table users(
id int auto_increment,
first_name varchar(50),
last_name varchar(100),
age int,
nationality varchar(100),
id_card varchar(50),
phone varchar(50),
email varchar(100),
password varchar(255),
is_active boolean default 1,
is_admin boolean default 0,
password_salt varchar(255),
primary key (id)
);
create a table name "account"
create table account(
account_number int auto_increment,
user_id int,
account_name varchar(50),
account_type varchar(50),
balance double,
is_active boolean default true,
foreign key (user_id) references users(id),
primary key(account_number)
);
dump in some data
INSERT INTO `bank_management`.`account` (`account_number`, `user_id`, `account_name`, `account_type`, `balance`) VALUES (123456788, 1, 'pichey', 'ffdsfsdfads', 999999);
create a table name "deposit"
create table deposit(
id int auto_increment,
user_id int,
account_no int,
amount double not null default 0,
date date,
time time,
foreign key (user_id) references users(id),
foreign key (account_no) references account(account_number),
primary key(id)
);
dump in some data
INSERT INTO `bank_management`.`deposit` (`deposit_id`,`user_id`,`amount`,`date`,`time`) VALUES ('1','1','100','2023-03-10','15:46:33');
create a table name "withdraw"
create table withdraw(
id int auto_increment,
user_id int,
account_no int,
amount double not null default 0,
date date,
time time,
foreign key (user_id) references users(id),
foreign key (account_no) references account(account_number),
primary key(id)
);
dump in some data
INSERT INTO `bank_management`.`withdraw` (`withdrawn_id`,`user_id`,`amount`,`date`,`time`) VALUES ('1','1','400','2023-03-10','15:48:56');
create a table name "transfer"
create table transfer(
id int auto_increment,
user_id int,
account_no int,
amount double not null default 0,
message text,
receiver_id int,
date date,
time time,
foreign key (user_id) references users(id),
foreign key (account_no) references account(account_number),
primary key(id)
);
dump in some data
INSERT INTO `bank_management`.`transfer` (`transfer_id`,`user_id`,`message`,`amount`,`receiver_id`,`date`,`time`) VALUES ('1','1','','100','2','2023-03-10','15:52:44');
INSERT INTO `bank_management`.`transfer` (`transfer_id`,`user_id`,`message`,`amount`,`receiver_id`,`date`,`time`) VALUES ('2','2','Good morning Yay!','225','3','2023-03-10','15:56:19');
create a table name "receive"
create table receive (
id int auto_increment,
account_no int,
amount double not null default 0,
message text,
sender varchar(255),
date date,
time time,
primary key(id)
);
run the project to see if the input data appear in the terminal;