PostgreSQL Tutorial
PostgreSQL is one of the most advanced general-purpose Relational database management systems (RDMS). It is open-source software, which means the source code is available under the PostgreSQL license. Anyone with the right skills is free to use, modify, and distribute PostgreSQL in any form. It supports both relational as well as Non-Relational JSON Queries.
In this PostgreSQL tutorial youβll learn the basic data types(Boolean, char, text, time, int etc.), Querying and Filtering techniques like select, where, in, order by, etc. managing and modifying the tables in PostgreSQL. Weβll cover all the basic to advance concepts of PostgreSQL in this tutorial.
What is PostgreSQL?
PostgreSQL is an advanced and open-source relational database system and is used as a database for many web applications, mobile and analytics applications. It supports both SQL (relational) and JSON (non-relational) querying and It is a stable database supported by more than 20 years of development by the open-source community.
Table of Content
|
PostgreSQL Tutorial For Begineers
PostgreSQL Basics
- PostgreSQL β Introduction
- Install PostgreSQL on Windows
- Install PostgreSQL on Mac
- PostgreSQL β Loading a Database
- PostgreSQL β Create Database
- PostgreSQL β ALTER DATABASE
- PostgreSQL β DROP DATABASE
- PostgreSQL β Rename Database
- PostgreSQL β Copy Database
- PostgreSQL β Size of a Database
- PostgreSQL β Show Databases
Data Types
- PostgreSQL β Data Types
- PostgreSQL β Boolean Data Type
- PostgreSQL β CHAR Data Type
- PostgreSQL β VARCHAR Data Type
- PostgreSQL β TEXT Data Type
- PostgreSQL β NUMERIC Data Type
- PostgreSQL β SMALLINT Integer Data Type
- PostgreSQL β INTEGER Data Type
- PostgreSQL β BIGINT Integer Data Type
- PostgreSQL β Date Data Type
- PostgreSQL β Timestamp Data Type.
- PostgreSQL β UUID Data Type
- PostgreSQL β TIME Data Type
- PostgreSQL β Interval Data Type
- PostgreSQL β User-defined Data Type
- PostgreSQL β Array Data Type
- PostgreSQL β hstore Data Type
- PostgreSQL β JSON Data Type
Querying & Filtering Data
- PostgreSQL β SELECT
- PostgreSQL β SELECT DISTINCT clause
- PostgreSQL β ORDER BY clause
- PostgreSQL β WHERE clause
- PostgreSQL β LIMIT clause
- PostgreSQL β FETCH clause
- PostgreSQL β IN operator
- PostgreSQL β IS NULL operator
- PostgreSQL β LIKE operator
- PostgreSQL β NOT LIKE operator
- PostgreSQL β BETWEEN operator
- PostgreSQL β HAVING clause
- PostgreSQL β GROUP BY clause
Managing Tables
- PostgreSQL β CREATE TABLE
- PostgreSQL β SELECT INTO
- PostgreSQL β Create Auto-increment Column using SERIAL
- PostgreSQL β CREATE SEQUENCE
- PostgreSQL β Identity Column
- PostgreSQL β ALTER TABLE
- PostgreSQL β Rename Table
- PostgreSQL β ADD COLUMN
- PostgreSQL β DROP COLUMN
- PostgreSQL β Change Column Type
- PostgreSQL β RENAME COLUMN
- PostgreSQL β DROP TABLE
- PostgreSQL β TRUNCATE TABLE
- PostgreSQL β Temporary Table
- PostgreSQL β Temporary table name
- PostgreSQL β Removing Temporary Table
- PostgreSQL β Copy a Table
- PostgreSQL β Comparing Tables
- PostgreSQL β Describe Table
- PostgreSQL β Show Tables
- PostgreSQL β Import CSV File Into Table
Modifying Data
Conditionals
Control Flow
Transactions & Constraints
Working with JOINS & Schemas
Roles & Permissions
Working with Sets
Subquery & CTEs
User-Defined Functions
Important In-Built Functions
- PostgreSQL β AVG() Function
- PostgreSQL β COUNT() Function
- PostgreSQL β MAX() Function
- PostgreSQL β MIN() Function
- PostgreSQL β SUM() Function
- PostgreSQL β FIRST_VALUE Function
- PostgreSQL β LAST_VALUE Function
- PostgreSQL β NTH_VALUE Function
- PostgreSQL β ROW_NUMBER Function
- PostgreSQL β CURRENT_DATE Function
- PostgreSQL β CURRENT_TIME Function
- PostgreSQL β EXTRACT Function
- PostgreSQL- CONCAT Function
- PostgreSQL β FORMAT Function
- PostgreSQL β UPPER function
- PostgreSQL- LOWER function
- PostgreSQL β REGEXP_MATCHES Function
- PostgreSQL β REGEXP_REPLACE Function
- PostgreSQL β REPLACE Function
Visit PostgreSQL In-Built functions for more.
Advanced PostgreSQL Tutorial
PostgreSQL PL/pgSQL
Variables & Constants
Stored Procedures
Working with Triggers
Working with Views & Indexes
Errors & Exception Handling
Features of PostgreSQL
PostgreSQL runs on all operating systems, Like Linux, UNIX, MAC OS and Windows and It supports text, images, sounds, and video, and includes programming interfaces for C / C++, Java, Perl, Python, Ruby, and Open Database Connectivity (ODBC).
PostgreSQL supports a big part of the SQL standard and provides many features mentioned below:
- Complex SQL queries
- SQL Sub-selects
- Foreign keys
- Trigger
- Views
- Transactions
- Multiversion concurrency control (MVCC)
- Streaming Replication (as of 9.0)
- Hot Standby (as of 9.0)
- Asynchronous replication
- Tablespaces
Advantages of PostgreSQL
- PostgreSQL has the feature of write-ahead logging.
- Many replication methods are supported.
- It has ability to make large-scale web applications because it is robust and powerful.
- It is easy to learn.
- According to the organization we can edit and modify it easily because PostgreSQL is available for free to its open source license.
Conclusion
In this PostgreSQL tutorial, You will learn all the essentials of working with PostgreSQL Like installation, connecting to the database, creating and managing databases, SQL basics, querying data, advanced queries and joins, indexing and optimization, transactions and concurrency control, security and user management, backup and restore, PostGIS for geospatial data, and PostgreSQL extensions. PostgreSQL provides number of features Which makes it a versatile and reliable choice for building robust database-driven applications.
PostgreSQL Tutorial β FAQs
1. How to create new Database in PostgreSQL?
There are two methods of creating a new database:
- CREATE DATABASE (SQL command)
- createdb (command-line executable)
2. What are the different Operators in PostgreSQL?
There are 4 different type of operators in PostgreSQL are as follow-
- Arithmetic operators
- Logic operators
- Comparison operators
- Bitwise operators
3. What are the disadvantages with PostgreSQL?
Performance wise PostgreSQL is slower than MySQL and Open source applications are less than MySQL.
4. How to delete a PostgreSQL database?
- DROP DATABASE (SQL command)
- dropdb (command-line)