simple-queries

CREATE Query

CREATE TABLE employees (
    id SERIAL PRIMARY KEY,
    name VARCHAR(100),
    age INT
);
  • Creates a new table named employees with columns id, name, and age.

SELECT Query

SELECT * FROM employees;
  • Retrieves all columns and rows from the employees table.

INSERT Query

INSERT INTO employees (name, age) VALUES ('John Doe', 30);

UPDATE Query

UPDATE employees SET age = 35 WHERE name = 'John Doe';
  • Modifies the age of the employee named 'John Doe' to 35.

DELETE Query

DELETE FROM employees WHERE name = 'John Doe';
  • Deletes the employee named 'John Doe' from the employees table.

Last updated