How to refer the foreign key in correspond table to reference table

in sql •  last month

    Create table cart_order(
    order_id INT,
    customer_id INT,
    product_id INT,
    quantity INT,
    order_date DATE,
    status VARCHAR(100),
    PRIMARY KEY (order_id),
    FOREIGN KEY (customer_id) REFERENCES customer(customer_id),
    FOREIGN KEY (product_id) REFERENCES product(product_id)
    );






    -Find out the number of unique countries of the customers in the customer table

    SELECT COUNT(DISTINCT country)

    FROM customers;


    - SELECT DISTINCT BillingCountry, BillingCity

    FROM invoices

    ORDER BY BillingCountry, BillingCity;

      Authors get paid when people like you upvote their post.
      If you enjoyed what you read here, create your account today and start earning FREE VOILK!