MySQL

내일은 SQL(응용 실전편) 실전_ch1-1-2-product&payment.sql

쿠카이든 2024. 5. 20. 13:20
728x90
[교재 SQL 스크립트] 실전_ch1-1-2-product&payment.sql
USE mydb;

CREATE TABLE product(
    product_no VARCHAR(4),
    product_name VARCHAR(20),
    price INT
);

CREATE TABLE payment (
    payment_no VARCHAR(8),
    member_id VARCHAR(10),
    product_no VARCHAR(4)
);

INSERT INTO product
VALUES ('S100', '미니선풍기', 3500);
INSERT INTO product
VALUES ('S101', '행운목', 2000);
INSERT INTO product
VALUES ('S102', '야광텀블러', 6500);
INSERT INTO product
VALUES ('S103', '포도당캔디', 3000);
INSERT INTO product
VALUES ('S104', '아로마오일', 10000);

INSERT INTO payment
VALUES ('24010101', 'tree25', 'S100');
INSERT INTO payment
VALUES ('24010102', 'sky1004', 'S100');
INSERT INTO payment
VALUES ('24010103', 'frog555', 'S102');
INSERT INTO payment
VALUES ('24010104', 'cup14', 'S103');
INSERT INTO payment
VALUES ('24010105', 'tree25', 'S104');
INSERT INTO payment
VALUES ('24010106', 'phone99', 'S104');
INSERT INTO payment
VALUES ('24010107', 'bear1070', 'S102');

COMMIT;
728x90