DBMS EXAM QUESTIONS AND ANSWERS
What is a database? - Answers - A collection of information organized for easy access,
management, and update
What is a database management system? - Answers - A random assortment of data
Which database model organizes data in a tree-like structure? - Answers - Hierarchical
Database
What is an ER diagram used for? - Answers - To represent real-world entities and their
relationships
This command adds one or more records to a database table. - Answers - INSERT
a built-in string function in PostgreSQL that concatenates two or more strings - Answers
- CONCAT
clause allows you to sort rows returned by a SELECT clause in ascending or
descending order based on a sort expression. - Answers - ORDER BY
What does ACID stand for in the context of database transactions? - Answers -
Atomicity, Consistency, Isolation, Durability
What does the COMMIT command do in SQL? - Answers - Ends the current transaction
and saves changes
What is the purpose of a trigger in PostgreSQL? - Answers - To automatically execute a
function when a specified event occurs
Which command is used to remove a trigger from a table in PostgreSQL? - Answers -
DROP TRIGGER
Which character data type in PostgreSQL can store a variable number of characters? -
Answers - VARCHAR
What does the NUMERIC(p, s) data type represent in PostgreSQL? - Answers - A fixed-
point number with p digits and s decimal places
What is a primary key? - Answers - A column or group of columns that uniquely
identifies a row in a table
Which of the following is a type of functional dependency? - Answers - Multivalued
Dependency
, Which command is used to create a new table in SQL? - Answers - CREATE TABLE
What constraint ensures that all values in a column are unique? - Answers - UNIQUE
data type can hold one of three possible values: true, false and NULL - Answers –
BOOLEAN
Which data type is used to store date and time values in PostgreSQL? - Answers -
TIMESTAMP
This command modifies data of one or more records. - Answers - UPDATE
What is the basic syntax for deleting rows from a table in PostgreSQL? - Answers -
DELETE FROM table_name WHERE condition;
How do you return the first n characters from a string in PostgreSQL? - Answers -
LEFT(string, n)
What function is used to replace all occurrences of a substring within a string in
PostgreSQL? - Answers - REPLACE
How do you extract a substring from a string in PostgreSQL? - Answers -
SUBSTRING(string FROM start FOR length)
Which clause is used to filter rows returned by a SELECT statement based on a
specified condition? - Answers - WHERE
Which clause is used to remove duplicate rows from a result set in PostgreSQL? -
Answers - DISTINCT
What operator is used to combine two conditions in a WHERE clause in PostgreSQL? -
Answers - AND
clause divides the rows returned from the SELECT statement into groups. - Answers -
GROUP BY
to calculate the sum of items - Answers - SUM()
to get the number of items in the groups. - Answers - COUNT()
is a SQL query nested inside a larger query - Answers - A subquery
once before the main query (outer query) executes. - Answers - The subquery (inner
query) executes
use the subquery result - Answers - The main query (outer query)
What is a database? - Answers - A collection of information organized for easy access,
management, and update
What is a database management system? - Answers - A random assortment of data
Which database model organizes data in a tree-like structure? - Answers - Hierarchical
Database
What is an ER diagram used for? - Answers - To represent real-world entities and their
relationships
This command adds one or more records to a database table. - Answers - INSERT
a built-in string function in PostgreSQL that concatenates two or more strings - Answers
- CONCAT
clause allows you to sort rows returned by a SELECT clause in ascending or
descending order based on a sort expression. - Answers - ORDER BY
What does ACID stand for in the context of database transactions? - Answers -
Atomicity, Consistency, Isolation, Durability
What does the COMMIT command do in SQL? - Answers - Ends the current transaction
and saves changes
What is the purpose of a trigger in PostgreSQL? - Answers - To automatically execute a
function when a specified event occurs
Which command is used to remove a trigger from a table in PostgreSQL? - Answers -
DROP TRIGGER
Which character data type in PostgreSQL can store a variable number of characters? -
Answers - VARCHAR
What does the NUMERIC(p, s) data type represent in PostgreSQL? - Answers - A fixed-
point number with p digits and s decimal places
What is a primary key? - Answers - A column or group of columns that uniquely
identifies a row in a table
Which of the following is a type of functional dependency? - Answers - Multivalued
Dependency
, Which command is used to create a new table in SQL? - Answers - CREATE TABLE
What constraint ensures that all values in a column are unique? - Answers - UNIQUE
data type can hold one of three possible values: true, false and NULL - Answers –
BOOLEAN
Which data type is used to store date and time values in PostgreSQL? - Answers -
TIMESTAMP
This command modifies data of one or more records. - Answers - UPDATE
What is the basic syntax for deleting rows from a table in PostgreSQL? - Answers -
DELETE FROM table_name WHERE condition;
How do you return the first n characters from a string in PostgreSQL? - Answers -
LEFT(string, n)
What function is used to replace all occurrences of a substring within a string in
PostgreSQL? - Answers - REPLACE
How do you extract a substring from a string in PostgreSQL? - Answers -
SUBSTRING(string FROM start FOR length)
Which clause is used to filter rows returned by a SELECT statement based on a
specified condition? - Answers - WHERE
Which clause is used to remove duplicate rows from a result set in PostgreSQL? -
Answers - DISTINCT
What operator is used to combine two conditions in a WHERE clause in PostgreSQL? -
Answers - AND
clause divides the rows returned from the SELECT statement into groups. - Answers -
GROUP BY
to calculate the sum of items - Answers - SUM()
to get the number of items in the groups. - Answers - COUNT()
is a SQL query nested inside a larger query - Answers - A subquery
once before the main query (outer query) executes. - Answers - The subquery (inner
query) executes
use the subquery result - Answers - The main query (outer query)