×

Top 15 PostgreSQL Interview Questions for 2024

1) What is PostgreSQL?

PostgreSQL is a most advance open source database system. PostgreSQL is an object Oriented Relational Database Management System (ORDBMS). PostgreSQL source code is available free of charge and it is not controlled by any corporation.

2) What are the features provided by PostgreSQL?

Following advance features are provided by PostgreSQL:
Indexes
Triggers
Multiversion concurrency control (MVCC).
Complex SQL queries
SQL Sub-selects
Foreign keys
Views
Tablespaces
Point-in-time recovery

3) Name data types which are used in PostgreSQL.

PostgreSQL supports the following data types:
Booloean
Character (char, varchar, text)
Numeric (Integer, Floating-point)
Temporal (date, time, timestamp, interval)
Array (array string, number)
JSON
hstore (key-value pair)

4) What are the different database tools for PostgreSQL?

Following are the database tools are used for PostgreSQL:
  • Psql
  • Pgadmin
  • Phppgadmin

5) How to start the PostgreSQL database server?

/usr/local/etc/rc.d/010.pgsql.sh start
/usr/local/etc/rc.d/postgresql start

6) How to check whether PostgreSQL server is running?

/usr/local/etc/rc.d/010.pgsql.sh status
/usr/local/etc/rc.d/postgresql status

7) How to stop the PostgreSQL database server?

/usr/local/etc/rc.d/010.pgsql.sh stop
/usr/local/etc/rc.d/postgresql stop

8) How to create PostgreSQL user?

Syntax:
CREATE USER user_name with condation;
Example:
CREATE USER Rohan with password="password";

9) How to create database?

There are two ways to create database in PostgreSQL:
Using CREATE DATABASE command
Using createdb a command line executable.
Syntax:
CREATE DATABASE database_name;
Example: In PosstgreSQL schema the above command is written as:
postgres=# CREATE DATABASE database_name;

10) How to drop PostgreSQL database?

DROP DATABASE command deletes all information (table, view, procedure etc) stored in the database. Example:
DROP DATABASE database_name;

11) How to create a new table in PostgreSQL?

We can create a new table by specifying table name, column name with their data type. Syntax:
CREATE TABLE tablename(column1 datatype, column2 datatype);
Example:
CREATE TABLE employee(  
id int,  
 name varchar(20),  
  salary int,  
);

12) How to drop table from database?

DROP TABLE command is used to remove (delete) table and all its data, rules, indexes, constraints etc from database. Syntax:
DROP TABLE table_name;

13) What is TRUNCATE statement?

TRUNCATE TABLE statement is used to remove all data quickly and efficiently from the table. Syntax:
TRUNCATE TABLE table_name;

14) What is DELETE statement in PostgreSQL?

DELETE statement is used to delete rows from the table. Syntax:
DELETE FROM table_name WHERE condation;

15) Compare TRUNCATE, DROP and DELETE statement for table in PostgreSQL.

Suppose that we have a database with name employeedb contain table employee_table. Let consider employee_table has following structure.
emp_id emp_name emp_salary department
101 Ajay 35000 Sales
102 Prakas 40000 Finance
103 Sunil 45000 IT
Let see what happen when we execute the above statements: DELETE FROM employee_table WHERE emp_id=102; It gives the following result.
emp_id emp_name emp_salary department
101 Ajay 35000 Sales
103 Sunil 45000 IT
TRUNCATE TABLE employee_table; It gives the following result.
emp_id emp_name emp_salary department
DROP TABLE employee_table; It remove complete table from database employeedb.

Related Topics

Top 15 SQL Server Interview Question for 2024

1) Describe SQL Server? SQL server is a DataBase Management System developed by Microsoft. It was first introduced in year 2008 since, then many version has been introduced such as :...

2 minutes read.

Top 25 CoffeeScript Interview Questions for 2024

1) What is CoffeeScript? It is a language that compiles into JavaScript. CoffeeScript is an attempt to expose good parts of JavaScript so, that user can code more easily. 2) Name the...

3 minutes read.

Top 30 Magento Interview Questions for 2024

1) What is Magento? Magento is an open-source content management system. It is used to create e-commerce websites. It is developed by Varien ,Inc, a US private company headquartered in Culver City, California. It...

5 minutes read.

Top 30 VB Script Interview Questions for 2024

1) What is VB Script? VBScript stands for Visual Basic Scripting Language. It is a light version of Microsoft Visual Basic. It is a client side scripting Language. 2) What is the...

5 minutes read.

Top 14 MathML Interview Questions for 2024

1) What is MathML? MathL stands for Mathematical Markup Language. It is extended form of XML. It is used to describe mathematical and scientific notations. 2) Who is the developer of MathML? World...

3 minutes read.

Top 30 SQL Interview Questions for 2024

1. What is SQL? Ans. SQL stands for Structured Query Language.  It is a standard computer language for accessing, storing, and manipulating data stored in the relational database. SQL become an International Standard Organization (ISO)...

11 minutes read.

Top 30 Sencha Touch Interview Questions for 2024

1) What is Sencha Touch? Sencha Touch is an UI (User Interface) JavaScript library. It is written in JavaScript. It is used to build mobile interface quickly and easily. It works...

6 minutes read.

Top 40 TensorFlow Interview Questions and Answers

Commonly Asked TensorFlow Interview Questions for Fresher Q1. What is TensorFlow? TensorFlow is the machine learning library developed by Google's brain team, it supports multiple abstraction levels, and we can choose the...

13 minutes read.

Top 14 Materialize CSS Framework Interview Questions for 2024

1) What is Materialize? Materialize is a CSS framework that contains library file. It is created with CSS, JavaScript and HTML. It helps to create attractive, reliable and functional web pages...

7 minutes read.

Top 15 T-SQL(Transact-SQL) Interview Questions for 2024

1) What is T-SQL? T-SQL stands for Transact Structured Query Language. T-SQL is the extension of SQL functionality supported by Microsoft SQL Server and Sybase ASE. 2) What are the features of...

3 minutes read.

Django Interview Questions for 2024

Django is an open-source python web framework. It is very popular due to the functionalities it offers. It uses the Model-View-Template architecture. Many giant organizations are using Django as their...

10 minutes read.

Top 20 HTTP Interview Questions for 2024

1) What is HTTP? HTTP stands for Hypertext Transfer Protocol. It is a set of rules for transferring of data on WWW (World Wide Web). 2) What are the basic Features of...

4 minutes read.

Top 15 VBA Interview Questions for 2024

1) What is VBA? VBA stands for Visual Basic Application. It is an event-driven programming language. It is mainly used with Microsoft Office applications such as MS -Excel, MS-Word and MS-Access. 2)...

3 minutes read.

Top 22 DOJO Interview Questions for 2024

1) What is DOJO? DOJO is an open source JavaScript framework designed for very fast development of JavaScript/AJAX based application and websites having cross platform interdependencies. 2) Enlist all features of DOJO. ...

4 minutes read.

Bugzilla interview Questions

Frequently asked questions about Bugzilla Q1. What are reports in Bugzilla? A1. Reports can be defined as an interface between the user and the database of Bugzilla. It helps to examine and...

4 minutes read.

Top 30 TurboGears Framework Interview Questions for 2024

1) What is TurboGears Framework? TurboGears is a Python Framework. It is used to create rapid web application. It consists of several WSGI (Web Server Gateway Interface) components. It is developed...

5 minutes read.

Top 15 ES6 Interview Questions for 2024

Commonly Asked ES6 Interview Questions and Answers 1) What is ES6? ES6 is a scripting language specification standardized. It is used to enable client-side scripting. The specification is influenced by programming languages (Self, Python, Perl,...

2 minutes read.

Top 15 Hadoop Interview Questions for 2024

1) What is Hadoop? Hadoop is a framework which is used to store and process Big Data. It is a distributed computing platform and helps in analyzing Big Data. 2) What are the...

2 minutes read.

WebSockets Interview Questions

1) What is Web Sockets? Web Sockets is a two way communication between the clients and the servers. Here, the clients and servers both the parties can communicate and exchange data...

3 minutes read.

Top 30 Zend Framework Interview Questions for 2024

1) What is Zend Framework? Zend is an open source, object-oriented web application framework. It is implemented in PHP 5. It was developed in 3 March 2006. 2) What is the use...

6 minutes read.