Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
632 B
0
Indexable
Never
CREATE TABLE CUSTOMER(
    ID INT PRIMARY KEY,
    NAME VARCHAR(50),
    EMAIL VARCHAR(50),
    PAYMENT VARCHAR(50)
);

CREATE TABLE ORDERS(
    ID INT PRIMARY KEY,
    ORDERDESCRIPTION VARCHAR(50),
    ORDERDATE VARCHAR(50),
    PRICE INT,
    CUSTOMER_ID INT,
    FOREIGN KEY (CUSTOMER_ID) REFERENCES CUSTOMER(ID)
);

INSERT INTO CUSTOMER (ID, NAME, EMAIL, PAYMENT) VALUES (1, 'John Doe', 'john@example.com', 'Credit Card');

INSERT INTO ORDERS (ID, ORDERDESCRIPTION, ORDERDATE, PRICE, CUSTOMER_ID) VALUES (101, 'Product A', '2024-02-14', 50, 1);

SELECT * FROM CUSTOMER WHERE ID = 1;

SELECT * FROM ORDERS WHERE CUSTOMER_ID = 1;
Leave a Comment