×

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 30 DBMS Interview Questions for 2024

1) What is DBMS? DBMS (Data Base Management System) is a technology for managing data of database i.e. Create, Update, Delete, Alter. 2) What is a Database System? It is defined as collection...

4 minutes read.

Top 16 Arduino Interview Questions for 2024

1) What is Arduino? Arduino is an open source electronic platform. It is based on easy-to-use hardware and software. It able to read input signal. It is used to write and...

2 minutes read.

Top 15 Apache Tapestry Interview Questions for 2024

1) What is Apache Tapestry? It is an open source web framework written in Java and can work under any application server. It is easily integrate with back ends like Hibernate...

2 minutes read.

VB.NET Interview Questions

1) What is VB.NET? VB.NET stands for Visual Basic .NET. It is an object oriented programming language. It is implemented on .NET framework and launched by Microsoft in 2001. 2) Who is...

3 minutes read.

Top 15 C Interview Questions for 2024

1) What are different storage class specifiers in C? Register,auto, static, extern are the storage class specifiers in C. 2) What is scope of a variable? How are variables scoped in C? Scope...

3 minutes read.

PhoneGap Interview Questions 2024

Top 50 Phonegap Interview Questions with their Answers Once you have acquired practical knowledge of the PhoneGap technology, you will now be able to search for a job as a mobile...

9 minutes read.

Top 15 Website Development Interview Questions for 2024

1) What is Website Development? Website Development is a process that includes following steps. web design web content development client-side or server-side scripting network security configuration etc 2) What are the skills...

3 minutes read.

Top 15 Framework7 Interview Questions for 2024

1) What is Framework7? Framework7 is an open source mobile HTML framework. It is used todevelop hybrid mobile apps for iOS and Android devices. 2) Why, framework7 is popular? There are various reasons...

8 minutes read.

Top 10 WCF Interview Questions for 2024

  1. What is WCF? Windows Communication Foundation (WCF), earlier known by the name Indigo, is a run-time platform and a set of APIs in the .NET Framework for building, configuring, and...

7 minutes read.

Top 15 Java BeanUtils Interview Questions for 2024

1) What is Java BeanUtils? Java BeanUtils is a design pattern component of the Apache Commons. It facilitates architecture for Java language which is derived from JavaAPI. It helps to set...

3 minutes read.

Top 30 Swift Interview Questions for 2024

1) What is Swift? It is an innovative programming language developed by Apple Inc. It is used for creating applications for iOS and OS X. 2) What are the features of Swift Programming? Features...

4 minutes read.

Top 16 WebGL Interview Questions for 2024

1) What is WebGL? WebGL stands for Web Graphics Library. It is a JavaScript API that is used for rendering 3D graphic in any compatible web browser. It is written in...

3 minutes read.

Top 15 Java Multithreading Interview Questions for 2024

1) What is Multithreading in Java ? It is a process of executing multiple threads simultaneously. It is used to achieve multitasking. It is mostly used in animation and games etc. 2) What are...

4 minutes read.

Top 27 JavaScript Interview Questions for 2024

1) Define Undeclared and Undefined Variables? Undeclared variable are defined as these variable is neither defined nor exist in the program. If program calls this variable then it causes Runtime error. Undefined variable...

5 minutes read.

Top 15 iOS (iPhone, iPad) Interview Questions for 2024

Top 20 Most Frequently asked iOS Interview Questions and Answers 1) What is iOS? iOS is a mobile operating system developed by Apple Inc. iOS offers iPhone and iPad application development using...

3 minutes read.

Top 30 Fortran Interview Questions for 2024

1) What is Fortran? Fortran is general purpose, high-level programming language which is used for numeric and scientific computing. 2) What are the features of Fortran programming language? Features of Fortran language are: ...

4 minutes read.

Top 15 CherryPy Interview Questions for 2024

1) What is CherryPy? CherryPy is a web framework used for Python. It provides a friendly interface for Http protocol for Python developer. 2) Why we use CherryPy? CherryPy has following strength: Simplicity: It...

3 minutes read.

Symfony PHP Framework Interview Questions

1) What is Symfony? Symfony is an open source, web application framework. It is written in PHP and used to design PHP applications. It was first released on18 October, 2005. 2) What...

5 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 43 React Native Interview Questions for 2024

1. What is React Native? React native is an open-source JavaScript framework designed by Facebook for native mobile applications development. It is based on a JavaScript library-React. React Native saves your development...

11 minutes read.