DEV Community

Cover image for PostgreSQL basics & clauses.
bagavath ravichandran
bagavath ravichandran

Posted on

1

PostgreSQL basics & clauses.

  • SQL:Structured query language
    It is programming language for storing and processing information in a relational database.

  • PostgreSQL:PostgreSQL (often called Postgres) is a free, open-source database management system and one of the type of SQL that stores and manages data in tables. It's known for its reliability, flexibility, and performance and can handle large amounts of data.

  • CLAUSE
    A clause in PostgreSQL is like a piece of a sentence in a SQL query. It helps tell the database what to do with the data. Think of it as giving step-by-step instructions.

Clauses are building blocks of SQL queries and help define operations such as filtering, sorting, grouping, and joining data.

-- FILTERING: Get employees older than 30
SELECT * FROM employees WHERE age > 30;

-- SORTING: Get employees sorted by salary (highest first)
SELECT * FROM employees ORDER BY salary DESC;

-- GROUPING: Count employees in each department
SELECT department, COUNT(*) FROM employees GROUP BY department;

-- JOINING: Get employees with their department names
SELECT employees.name, departments.name 
FROM employees 
JOIN departments ON employees.department_id = departments.id;

Enter fullscreen mode Exit fullscreen mode

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Security LIVE!

Join us for AWS Security LIVE!

Discover the future of cloud security. Tune in live for trends, tips, and solutions from AWS and AWS Partners.

Learn More

👋 Kindness is contagious

DEV is better (more customized, reading settings like dark mode etc) when you're signed in!

Okay