0% found this document useful (0 votes)
24 views21 pages

PostgreSQL Topics Presentation

The document outlines essential SQL commands for database management, including creating and deleting databases and tables, querying data with SELECT, and using various clauses and operators. It also covers constraints, joins, and functions for manipulating and aggregating data. Key operations such as ALTER TABLE, UPDATE, and TRUNCATE TABLE are also described.

Uploaded by

Ashish Divakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views21 pages

PostgreSQL Topics Presentation

The document outlines essential SQL commands for database management, including creating and deleting databases and tables, querying data with SELECT, and using various clauses and operators. It also covers constraints, joins, and functions for manipulating and aggregating data. Key operations such as ALTER TABLE, UPDATE, and TRUNCATE TABLE are also described.

Uploaded by

Ashish Divakar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

Create a Database and Delete a

Database
• Creating a database involves using the CREATE
DATABASE statement. Deleting a database is
done using the DROP DATABASE statement.
Create and Delete a Table
• Tables are created with the CREATE TABLE
statement and deleted with the DROP TABLE
statement.
Select in Postgre SQL
• The SELECT statement is used to query the
database and retrieve data.
Where clause and Comparison
operators
• The WHERE clause filters records based on
specified conditions. Comparison operators
include =, <>, >, <, >=, <=.
Logical operators
• Logical operators such as AND, OR, and NOT
are used to combine multiple conditions in
SQL.
Like operators
• The LIKE operator is used in a WHERE clause
to search for a specified pattern in a column.
Check Constraint
• CHECK constraints ensure that all values in a
column satisfy a specific condition.
Unique and Not Null Constraint
• UNIQUE constraints ensure all values in a
column are different. NOT NULL constraints
ensure that a column cannot have a NULL
value.
Primary Key and Foreign Key
• A primary key uniquely identifies each record
in a table. A foreign key links two tables
together.
Alter Table
• The ALTER TABLE statement is used to add,
delete, or modify columns in an existing table.
Update Table
• The UPDATE statement is used to modify
existing records in a table.
Group By and Having Clause
• GROUP BY groups rows that have the same
values. HAVING filters groups based on a
specified condition.
String Functions
• String functions manipulate text strings.
Examples include CONCAT(), LENGTH(), and
SUBSTRING().
Aggregate Functions
• Aggregate functions perform calculations on
multiple values and return a single value.
Examples include COUNT(), AVG(), and SUM().
Like In
• The LIKE operator is used to search for a
specified pattern. IN operator allows
specifying multiple values in a WHERE clause.
Cross Join
• A CROSS JOIN returns the Cartesian product of
the two tables.
Inner Join
• An INNER JOIN returns records that have
matching values in both tables.
Left and Right outer Join
• LEFT JOIN returns all records from the left
table and matched records from the right
table. RIGHT JOIN returns all records from the
right table and matched records from the left
table.
Full Outer Join
• A FULL OUTER JOIN returns all records when
there is a match in either left or right table.
Subqueries
• Subqueries are queries nested inside another
query.
Truncate Table
• The TRUNCATE TABLE statement is used to
delete all rows in a table without logging the
individual row deletions.

You might also like