Author: admin
-
LIKE Clause
The PostgreSQL LIKE operator is used to match text values against a pattern using wildcards. If the search expression can be matched to the pattern expression, the LIKE operator will return true, which is 1. There are two wildcards used in conjunction with the LIKE operator − The percent sign represents zero, one, or multiple numbers or characters.…
-
DELETE Query
The PostgreSQL DELETE Query is used to delete the existing records from a table. You can use WHERE clause with DELETE query to delete the selected rows. Otherwise, all the records would be deleted. Syntax You can combine N number of conditions using AND or OR operators. Example The following is an example, which would DELETE a…
-
UPDATE Query
The PostgreSQL UPDATE Query is used to modify the existing records in a table. You can use WHERE clause with UPDATE query to update the selected rows. Otherwise, all the rows would be updated. Syntax You can combine N number of conditions using AND or OR operators. Example The following is an example, which would update ADDRESS…
-
SELECT Query
PostgreSQL SELECT statement is used to fetch the data from a database table, which returns data in the form of result table. These result tables are called result-sets. Syntax Here, column1, column2…are the fields of a table, whose values you want to fetch. If you want to fetch all the fields available in the field then you…
-
INSERT Query
The PostgreSQL INSERT INTO statement allows one to insert new rows into a table. One can insert a single row at a time or several rows as a result of a query. Syntax You may not need to specify the column(s) name in the SQL query if you are adding values for all the columns of the…
-
Schema
A schema is a named collection of tables. A schema can also contain views, indexes, sequences, data types, operators, and functions. Schemas are analogous to directories at the operating system level, except that schemas cannot be nested. PostgreSQL statement CREATE SCHEMA creates a schema. Syntax The basic syntax of CREATE SCHEMA is as follows −CREATE SCHEMA name;…
-
CREATE Table
The PostgreSQL CREATE TABLE statement is used to create a new table in any of the given database. Syntax Basic syntax of CREATE TABLE statement is as follows −CREATE TABLE table_name( column1 datatype, column2 datatype, column3 datatype, ….. columnN datatype, PRIMARY KEY( one or more columns ) ); CREATE TABLE is a keyword, telling the…
-
SELECT Database
This chapter explains various methods of accessing the database. Assume that we have already created a database in our previous chapter. You can select the database using either of the following methods − Database SQL Prompt Assume you have already launched your PostgreSQL client and you have landed at the following SQL prompt −postgres=# OS…
-
CREATE Database
This chapter discusses about how to create a new database in your PostgreSQL. PostgreSQL provides two ways of creating a new database − Using CREATE DATABASE This command will create a database from PostgreSQL shell prompt, but you should have appropriate privilege to create a database. By default, the new database will be created by…
-
Data Type
In this chapter, we will discuss about the data types used in PostgreSQL. While creating table, for each column, you specify a data type, i.e., what kind of data you want to store in the table fields. This enables several benefits − PostgreSQL supports a wide set of Data Types. Besides, users can create their…