1단계_자료정리

이소연's avatar
Aug 05, 2024
1단계_자료정리
 
판매자 깃)( local8080)
구매자 : local8090
 
5.10))
 
5.18~19일 숙제🐥🐥🐥 구매자서버 : mysql 연결, 로그인, 회원가입, 상품목록보기_과일나라 외우기 / 포트 8090로 해서 -- DI, IOC 개념 설명
 
현재 인텔리 아이콘)
notion image
과거용 인텔리 아이콘)
notion image
create user 'root'@'localhost' identified by'1234'; GRANT ALL PRIVILEGES ON store.* To'root'@'localhost'; FLUSH PRIVILEGES; CREATE DATABASE store; drop user 'root'@'localhost'; use store; show variables like 'c%'; drop table product_tb; create table product_tb( product_id int auto_increment primary key, product_name varchar(20) not null unique, product_price int not null, product_qty int not null, created_at timestamp not null ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; select * from product_tb; INSERT INTO product_tb(product_name, product_price, product_qty, created_at) VALUES('딸기', 1000, 100, NOW()); INSERT INTO product_tb(product_name, product_price, product_qty, created_at) VALUES('복숭아', 2000, 100, NOW()); INSERT INTO product_tb(product_name, product_price, product_qty, created_at) VALUES('수박', 3000, 90, NOW()); INSERT INTO product_tb(product_name, product_price, product_qty, created_at) VALUES('포도', 2000, 80, NOW()); INSERT INTO product_tb(product_name, product_price, product_qty, created_at) VALUES('살구', 1500, 150, NOW()); drop table buyer_tb; create table buyer_tb( buyer_id int auto_increment primary key, buyer_name varchar(20) not null, buyer_pw varchar(20) not null, buyer_email varchar(30) not null, created_at timestamp not null ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; select * from buyer_tb; INSERT INTO buyer_tb(buyer_name, buyer_pw, buyer_email, created_at) VALUES('ssar','1234','ssar@nate.com',NOW()); INSERT INTO buyer_tb(buyer_name, buyer_pw, buyer_email, created_at) VALUES('cos', '1234', 'cos@nate.com', NOW()); INSERT INTO buyer_tb(buyer_name, buyer_pw, buyer_email, created_at) VALUES('love', '1234', 'love@nate.com', NOW()); INSERT INTO buyer_tb(buyer_name, buyer_pw, buyer_email, created_at) VALUES('zal', '1234', 'zal@nate.com', NOW()); INSERT INTO buyer_tb(buyer_name, buyer_pw, buyer_email, created_at) VALUES('hae', '1234', 'hae@nate.com', NOW()); drop table purchase_tb; drop table buyer_tb; select * from product_tb; select * from purchase_tb;purchase_tb select * from buyer_tb; select * from buyer_tb where buyer_id = 1; select * from purchase_tb where buyer_id = 1; desc purchase_tb; drop table pur_tb; drop table purchase_tb; CREATE TABLE purchase_tb ( pur_id INT AUTO_INCREMENT PRIMARY KEY, buyer_id INT, buyer_name varchar(20) not null, product_id INT, product_name varchar(20) not null, product_price Int, product_qty INT NOT NULL, pur_qty INT NOT NULL, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); INSERT INTO purchase_tb(buyer_id, buyer_name, product_id, product_name, product_price, product_qty, pur_qty, created_at) VALUES (1, 'ssar', 1, '딸기', 1000, 100, 10, NOW()), (2, 'cos', 2, '복숭아', 2000, 100, 10, NOW()), (3, 'love', 3, '수박', 3000, 90, 10, NOW()), (4, 'zal', 4, '포도', 2000, 80, 10, NOW()), (5, 'hae', 5, '살구',1500, 150, 10, NOW()) ; delete from purchase_tb where id = 6; delete from purchase_tb where id = 7;
 

if, 구매목록 산 것들 wanna reset

notion image
tb 클릭 후 >>
DELETE FROM purchase_tb WHERE pur_id BETWEEN 9 AND 29;
SELECT * FROM purchase_tb;
 

과일 수량 수정 및 reset>> seller 수정하기에서 수정

notion image
notion image
⬇️⬇️⬇️
notion image
notion image
⬇️⬇️⬇️
notion image
⬇️⬇️⬇️ 수정완료
notion image
 
⬇️⬇️⬇️ 구매자 서버에도 자동으로 동기화, 수정완료!
notion image
Share article

Coding's note