Skip to content

USAGE

CREATE TABLE customers (
customer_id INT,
customer_name VARCHAR(50),
customer_city VARCHAR(50)
);
INSERT INTO customers
(customer_id, customer_name, customer_city)
VALUES
(1, 'John Doe', 'New York'),
(2, 'Jane Doe', 'Los Angeles'),
(3, 'Mike Smith', 'Chicago');
SELECT * FROM customers;
customer_id | customer_name | customer_city
-------------+---------------+--------------
1 | John Doe | New York
2 | Jane Doe | Los Angeles
3 | Mike Smith | Chicago

The CREATE TABLE command is used to create a new table in the database. Three fields are specified: customer_id, customer_name, and customer_city.

The INSERT INTO command is then used to populate the table customers with data.

Finally, the SELECT command is used to retrieve all data from the customers table. It outputs the rows of the table, where each row represents a unique customer with their associated ID, name, and city.