PostgreSQL Basics PDF
Document Details
Uploaded by Deleted User
Tags
Summary
This document provides a tutorial/cheat sheet on PostgreSQL basics, explaining filtering data based on numeric and text columns, along with different ways of aggregating data.
Full Transcript
> Filtering Data > Aggregating Data Filtering on numeric columns...
> Filtering Data > Aggregating Data Filtering on numeric columns Simple aggregations PostgreSQL Basics Get rows where a number is greater than a value with WHERE col > n SELECT make, model, time_to_60_mph_s Get the total number of rows SELECT COUNT(*) SELECT COUNT(*) FROM cars FROM cars WHERE time_to_60_mph_s > 2.1 Learn SQL online at www.DataCamp.com Get rows where a number is greater than or equal to a value with WHERE col >= n Get the total value of a column with SELECT SUM(col) SELECT make, model, time_to_60_mph_s SELECT SUM(limited_production_count) FROM cars FROM cars WHERE time_to_60_mph_s >= 2.1 Get the mean value of a column with SELECT AVG(col) Get rows where a number is less than a value with WHERE col < n What is PostgreSQL? SELECT make, model, time_to_60_mph_s SELECT AVG(time_to_60_mph_s) FROM cars FROM cars PostgreSQL is an open-source relational database management system (RDBMS) known for its WHERE time_to_60_mph_s < 2.1 Get the minimum value of a column with SELECT MIN(col) extensibility and standards compliance. Developed and maintained by a group of volunteers Get rows where a number is less than or equal to a value with WHERE col