Database Design & Development Practice Exam
What is the primary purpose of data normalization in database design?
To improve database performance
B. To remove data redundancy and ensure data integrity
C. To increase data storage requirements
D. To create backup copies of the database
Which SQL statement is used to create a new database?
CREATE TABLE
B. CREATE DATABASE
C. INSERT DATABASE
D. ALTER DATABASE
In a relational database, which of the following is true about a primary key?
It can have duplicate values.
B. It must be unique for each record.
C. It can contain NULL values.
D. It is optional in every table.
What is a foreign key used for in a relational database?
To define a unique identifier for a table
B. To create relationships between two tables
C. To improve query performance
D. To store large data types
Which SQL statement is used to delete a table from a database?
DELETE TABLE
B. DROP TABLE
C. REMOVE TABLE
D. ERASE TABLE
What is the function of DDL (Data Definition Language)?
It is used to retrieve data from the database.
B. It is used to define and modify database structures.
C. It is used to manipulate data within tables.
D. It is used to manage database transactions.
Which of the following is an example of a non-relational database?
MySQL
B. MongoDB
C. Oracle
D. PostgreSQL
What is the purpose of a data dictionary in a database system?
To store actual data
B. To define metadata about database structures
C. To store backup copies of the database
D. To optimize query performance
Which normalization form eliminates all transitive dependencies?
First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Third Normal Form (3NF)
D. Boyce-Codd Normal Form (BCNF)
What does the SQL keyword “VIEW” refer to?
A physical table in the database
B. A virtual table based on a SELECT query
C. A copy of another table
D. A backup of a table
Which of the following is NOT a type of JOIN in SQL?
INNER JOIN
B. OUTER JOIN
C. CROSS JOIN
D. SUB JOIN
Which of the following is used to uniquely identify a record in a table?
Foreign Key
B. Primary Key
C. Composite Key
D. Unique Index
Which SQL clause is used to filter records based on conditions?
SELECT
B. WHERE
C. FROM
D. GROUP BY
What is a sub-query in SQL?
A query that modifies data
B. A query nested within another query
C. A query used to delete duplicate rows
D. A query used to create a new table
Which command is used to add a new column to an existing table?
ALTER DATABASE
B. ALTER TABLE
C. UPDATE TABLE
D. INSERT COLUMN
What is the purpose of indexing in a database?
To reduce storage space
B. To improve query performance
C. To eliminate duplicate records
D. To enforce constraints
Which of the following is a valid SQL aggregate function?
SUM
B. AVG
C. MAX
D. All of the above
Which SQL command is used to insert data into a table?
INSERT INTO
B. ADD DATA
C. INSERT TABLE
D. ADD INTO
What does “ACID” stand for in the context of database transactions?
Atomicity, Consistency, Isolation, Durability
B. Access, Control, Integrity, Durability
C. Accuracy, Consistency, Isolation, Database
D. Atomicity, Control, Isolation, Database
What is a primary characteristic of non-relational databases?
Data is stored in tables with predefined schemas.
B. Data is stored in a flexible, schema-less format.
C. They only support structured data.
D. They are incompatible with cloud environments.
Which command is used to remove all rows from a table without removing the table itself?
DROP
B. TRUNCATE
C. DELETE
D. REMOVE
What is the role of a database schema?
To store user data
B. To define the structure and organization of data
C. To enforce database transactions
D. To back up the database
What does the SQL keyword “GROUP BY” do?
Sorts records by a specified column
B. Filters records based on conditions
C. Groups records with the same values into summary rows
D. Deletes duplicate rows in a table
Which of the following is NOT a DML (Data Manipulation Language) operation?
INSERT
B. UPDATE
C. DELETE
D. CREATE
What type of relationship exists between tables when one record in a table corresponds to many records in another?
One-to-One
B. One-to-Many
C. Many-to-Many
D. None of the above
Which SQL keyword is used to sort records in ascending or descending order?
GROUP BY
B. ORDER BY
C. SORT
D. FILTER
Which of the following commands is used to rename a table in SQL?
RENAME TABLE
B. ALTER TABLE RENAME
C. UPDATE TABLE NAME
D. MODIFY TABLE
What is the purpose of SQL constraints?
To define relationships between tables
B. To enforce rules at the table level
C. To improve query performance
D. To create backups
Which SQL statement is used to remove a database entirely?
DELETE DATABASE
B. REMOVE DATABASE
C. DROP DATABASE
D. ERASE DATABASE
Which of the following is a characteristic of a relational database?
Data is stored as key-value pairs.
B. Data is organized into tables with rows and columns.
C. Data is stored as flat files.
D. Data is stored in a hierarchical format.
What does the SQL “HAVING” clause do?
Filters records before grouping.
B. Filters records after grouping.
C. Sorts records in ascending order.
D. Removes duplicate rows.
Which data type is best suited for storing large amounts of text in a SQL database?
VARCHAR
B. TEXT
C. CHAR
D. BLOB
Which of the following is an example of a composite key?
A single column used to uniquely identify a record.
B. A combination of two or more columns used to uniquely identify a record.
C. A column with duplicate values.
D. A column used as a foreign key.
In database terminology, what is a “tuple”?
A column in a table.
B. A single row in a table.
C. A table in a database.
D. A relationship between tables.
What does the term “referential integrity” mean in a database?
Ensuring every record has a unique identifier.
B. Ensuring foreign key values match primary key values in related tables.
C. Preventing duplicate rows in a table.
D. Ensuring data types are consistent across columns.
Which of the following best describes a “star schema”?
A hierarchical structure for data storage.
B. A relational schema where a central table is connected to multiple dimension tables.
C. A schema where all tables are connected in a circular relationship.
D. A schema used for non-relational databases.
In SQL, which of the following constraints is used to ensure a column cannot contain NULL values?
PRIMARY KEY
B. UNIQUE
C. NOT NULL
D. CHECK
Which command is used to rollback a transaction in SQL?
ROLLBACK
B. REVERSE
C. CANCEL
D. UNDO
What is a database trigger?
A scheduled task that runs periodically.
B. A function that automatically executes in response to specific database events.
C. A manual process for updating data.
D. A constraint that ensures data integrity.
What is the main advantage of using a view in SQL?
It stores data permanently.
B. It enhances database security and simplifies complex queries.
C. It increases database performance.
D. It removes duplicate data from tables.
Which of the following is an example of a one-to-one relationship?
A student and their enrolled courses.
B. A person and their passport.
C. A customer and their orders.
D. A book and its authors.
Which operator is used to test for the presence of values in a subquery?
EXISTS
B. IN
C. LIKE
D. BETWEEN
Which of the following SQL statements is used to combine rows from two or more tables, based on a related column?
UNION
B. INTERSECT
C. JOIN
D. MERGE
What is the purpose of the “CHECK” constraint in SQL?
To ensure a column has unique values.
B. To enforce a condition on the values in a column.
C. To ensure a column cannot contain NULL values.
D. To link two tables.
In a database, what is the relationship between tables that share a many-to-many association?
Directly linked without any intermediary.
B. Linked through a junction table.
C. Linked via a unique index.
D. Linked by combining their primary keys.
Which of the following is a valid SQL command for updating data in a table?
MODIFY
B. UPDATE
C. CHANGE
D. ALTER
Which of the following is NOT a type of NoSQL database?
Key-Value Store
B. Document Store
C. Column-Oriented Store
D. Relational Store
What is the main purpose of an ERD (Entity-Relationship Diagram) in database design?
To represent database performance metrics.
B. To define physical database storage.
C. To graphically represent entities and their relationships.
D. To write SQL queries.
Which of the following tools is typically used to load and unload data in a database?
ETL (Extract, Transform, Load) tools
B. Data Normalization tools
C. SQL Performance Optimizers
D. Transaction Monitors
51. Which SQL command is used to create a new table in a database?
INSERT
B. CREATE TABLE
C. ALTER TABLE
D. ADD TABLE
What is the purpose of data normalization in database design?
To reduce database size.
B. To eliminate data redundancy and improve data integrity.
C. To create indexes for faster query performance.
D. To backup data in a secure format.
Which of the following SQL clauses is used to sort query results?
WHERE
B. ORDER BY
C. GROUP BY
D. SORT
In which of the following scenarios is a non-relational database typically preferred?
When the data is highly structured.
B. When relationships between entities are complex.
C. When the data is unstructured or semi-structured, such as JSON or XML.
D. When ACID compliance is critical.
Which of the following SQL statements is used to delete a table and all its data?
DELETE TABLE
B. TRUNCATE TABLE
C. DROP TABLE
D. REMOVE TABLE
Which of the following is an essential feature of a primary key?
It allows duplicate values.
B. It can be NULL.
C. It uniquely identifies each row in a table.
D. It is used to enforce foreign key constraints.
What is the purpose of an index in a database?
To improve the security of data.
B. To reduce redundancy in a table.
C. To speed up data retrieval operations.
D. To enforce referential integrity.
What is the difference between INNER JOIN and OUTER JOIN in SQL?
INNER JOIN includes unmatched rows from both tables, whereas OUTER JOIN includes only matched rows.
B. INNER JOIN includes only matched rows from both tables, whereas OUTER JOIN includes unmatched rows as well.
C. INNER JOIN is faster than OUTER JOIN.
D. INNER JOIN requires indexes, whereas OUTER JOIN does not.
Which of the following commands is used to grant permissions to a user in SQL?
PERMIT
B. GRANT
C. ALLOW
D. ASSIGN
What does the acronym ACID stand for in the context of database transactions?
Availability, Consistency, Integration, Durability
B. Atomicity, Consistency, Isolation, Durability
C. Accessibility, Control, Integrity, Durability
D. Accuracy, Consistency, Isolation, Dependency
Which of the following is true about foreign keys?
A foreign key cannot accept NULL values.
B. A foreign key must always reference the primary key in another table.
C. A foreign key is a unique identifier for a row in its table.
D. A foreign key automatically enforces referential integrity.
What is the purpose of the “DISTINCT” keyword in SQL?
To sort the query results.
B. To return unique values from a column.
C. To remove duplicate rows from a table.
D. To limit the number of rows returned.
Which of the following is a valid example of a SQL aggregate function?
SUM()
B. AVG()
C. COUNT()
D. All of the above
What is the main function of a data dictionary in a database?
To store the actual data in the database.
B. To maintain metadata about the database objects.
C. To perform automatic backups of the database.
D. To handle user authentication and authorization.
Which of the following is a disadvantage of database denormalization?
Increased data redundancy
B. Improved query performance
C. Simplified table relationships
D. Reduced database complexity
What is the purpose of the SQL “CASE” statement?
To perform conditional logic in a query.
B. To define the structure of a table.
C. To specify the conditions of a foreign key constraint.
D. To remove duplicate rows from the result set.
Which of the following is a feature of a non-relational (NoSQL) database?
Strict schema enforcement
B. High scalability for large volumes of unstructured data
C. Strong ACID compliance
D. Use of tables to store data
Which of the following SQL keywords is used to combine rows from two queries into a single result set, removing duplicate rows?
UNION
B. INTERSECT
C. UNION ALL
D. EXCEPT
In a relational database, what is the purpose of a surrogate key?
To replace foreign keys with a more readable format.
B. To act as a primary key when no natural key exists.
C. To create a hierarchical relationship between rows.
D. To index rows for faster retrieval.
What is the purpose of the “ALTER TABLE” command in SQL?
To delete a table.
B. To modify an existing table structure.
C. To add data to a table.
D. To create a new table.
In a relational database, what does the term “cardinality” refer to?
The number of rows in a table.
B. The number of relationships between tables.
C. The number of distinct values in a column.
D. The number of foreign keys in a table.
Which of the following is an example of a NoSQL database?
PostgreSQL
B. MongoDB
C. Oracle
D. MySQL
Which type of JOIN returns all records when there is a match in one of the tables, even if there is no match in the other?
INNER JOIN
B. OUTER JOIN
C. LEFT JOIN
D. RIGHT JOIN
Which of the following best describes a “primary key” in a table?
A field that uniquely identifies each row in the table.
B. A field that allows null values.
C. A field that is used for sorting records.
D. A field that can contain duplicate values.
Which SQL clause is used to group rows that have the same values in specified columns?
GROUP BY
B. ORDER BY
C. HAVING
D. WHERE
What does the term “normalization” in database design refer to?
Reducing the complexity of queries.
B. Removing redundant data and ensuring data integrity.
C. Increasing data redundancy to improve performance.
D. Grouping all data into a single table.
In which of the following scenarios would you use a “JOIN” clause?
To delete rows from a table.
B. To combine data from multiple tables.
C. To update multiple records at once.
D. To group rows together.
Which of the following SQL commands is used to remove data from a table?
DELETE
B. REMOVE
C. TRUNCATE
D. DROP
What does the SQL command “TRUNCATE” do?
Deletes specific rows in a table.
B. Deletes the entire table structure.
C. Removes all data from a table but retains its structure.
D. Alters the table structure.
Which of the following is true about SQL indexes?
They improve query performance by allowing faster access to data.
B. They are only used in NoSQL databases.
C. They can be used to enforce data integrity.
D. They are automatically created when a table is created.
What is the advantage of using a “view” in a database?
It speeds up database performance.
B. It allows you to store complex queries as virtual tables.
C. It reduces the amount of data storage.
D. It eliminates the need for foreign keys.
In SQL, what is the purpose of the “LIMIT” clause?
To specify the maximum number of rows returned in the result set.
B. To restrict the type of data that can be inserted.
C. To delete a specific record from a table.
D. To order the results of a query.
What does the “IN” operator do in SQL?
It tests whether a value matches any value in a list or subquery.
B. It joins two tables based on a related column.
C. It returns rows that are identical in both tables.
D. It checks for NULL values in a column.
Which of the following is an advantage of using a relational database over a flat file system?
Relational databases are easier to maintain and can handle larger amounts of data.
B. Flat file systems are more flexible in handling data.
C. Relational databases do not require a specific structure.
D. Flat file systems automatically normalize data.
What is the main disadvantage of using the “VARCHAR” data type?
It requires more storage than the “CHAR” data type.
B. It does not allow NULL values.
C. It can store fixed-length data only.
D. It can require more storage due to varying string lengths.
What is the difference between “DELETE” and “TRUNCATE” in SQL?
“DELETE” removes all rows and the structure of the table, while “TRUNCATE” only removes the structure.
B. “DELETE” removes specific rows based on a condition, while “TRUNCATE” removes all rows.
C. “DELETE” is faster than “TRUNCATE.”
D. “TRUNCATE” removes data, but “DELETE” does not.
In a relational database, which of the following would be a candidate for a “foreign key”?
A column that uniquely identifies a row in the same table.
B. A column that references a primary key in another table.
C. A column that enforces data integrity.
D. A column that contains NULL values.
Which of the following is true about SQL “subqueries”?
A subquery is a query that is nested within another query.
B. A subquery can only be used with SELECT statements.
C. A subquery is used to store large amounts of data.
D. A subquery is faster than a regular query.
What is the purpose of the “EXISTS” operator in SQL?
To check whether a subquery returns any rows.
B. To combine the results of two queries.
C. To sort the results of a query.
D. To retrieve data from multiple tables.
What is the best use case for using a “junction table”?
To store additional information about a primary key.
B. To model a many-to-many relationship between two tables.
C. To index columns for faster queries.
D. To enforce data integrity in a single table.
Which of the following is a valid use of the SQL “GROUP BY” clause?
To group rows with the same values in a specified column.
B. To order the rows in a result set.
C. To join two tables based on related columns.
D. To delete multiple rows at once.
What does the SQL “UPDATE” statement do?
It modifies an existing table structure.
B. It retrieves records from a table.
C. It modifies existing data in a table.
D. It deletes rows from a table.
Which of the following best describes “denormalization”?
The process of reducing data redundancy by splitting tables.
B. The process of combining multiple tables into a single table.
C. The process of adding indexes to tables for faster querying.
D. The process of removing NULL values from columns.
Which of the following SQL functions is used to calculate the total sum of values in a column?
COUNT()
B. SUM()
C. AVG()
D. MAX()
What does the term “redundancy” in a database refer to?
Storing the same data in multiple places, which can lead to inconsistencies.
B. Using indexes to improve query performance.
C. The ability to store large amounts of data efficiently.
D. A technique used for data compression.
Which SQL command is used to change the structure of an existing table, such as adding a column?
MODIFY TABLE
B. ALTER TABLE
C. CHANGE TABLE
D. UPDATE TABLE
What is a benefit of using an “entity-relationship diagram” (ERD)?
It defines the relationships and structure of a database visually.
B. It provides a platform for coding SQL queries.
C. It stores actual data values for each entity.
D. It automatically normalizes the database structure.
Which of the following is NOT a valid SQL data type?
VARCHAR
B. INTEGER
C. STRING
D. DATE
Which of the following best describes “data integrity” in a database?
Ensuring that data is stored in the correct format.
B. Ensuring that data is correct, consistent, and reliable.
C. Ensuring that data is stored in a normalized form.
D. Ensuring that data can be easily accessed and queried.
Which of the following best describes a “composite key” in a relational database?
A key that is a combination of two or more columns to uniquely identify a row.
B. A key that can only be used to delete rows in a table.
C. A key that is automatically generated by the database.
D. A key that does not allow NULL values.
What is the main purpose of the “HAVING” clause in SQL?
To filter records after grouping.
B. To specify the order of the result set.
C. To filter records before grouping.
D. To delete rows from a table.
Which of the following SQL statements is used to add a new record to a table?
INSERT INTO
B. CREATE TABLE
C. UPDATE
D. DELETE
What is the purpose of a “normalized” database?
To minimize redundancy and dependency by dividing data into separate tables.
B. To store data in a single table for faster access.
C. To ensure that every table contains only one column.
D. To reduce the complexity of SQL queries.
In which of the following scenarios would a “LEFT JOIN” be used?
To get all records from the left table and matching records from the right table.
B. To get all records from both tables regardless of a match.
C. To get only the rows with matching records from both tables.
D. To exclude NULL values from the results.
Which SQL clause is used to filter records based on specific conditions?
WHERE
B. GROUP BY
C. ORDER BY
D. HAVING
What is the primary function of the “COUNT()” function in SQL?
To count the number of rows in a table.
B. To calculate the total of a numeric column.
C. To find the maximum value in a column.
D. To find the average value in a column.
In a relational database, which of the following ensures that each record in a table is unique?
Foreign Key
B. Primary Key
C. Index
D. Data Type
Which SQL keyword is used to specify the sorting order of query results?
GROUP BY
B. ORDER BY
C. HAVING
D. WHERE
Which of the following is a characteristic of a “NoSQL” database?
It uses tables and structured queries like relational databases.
B. It is designed for horizontal scalability and high availability.
C. It enforces strong consistency rules across the database.
D. It can only handle relational data.
Which SQL statement is used to remove a table and all of its data from the database?
REMOVE TABLE
B. DELETE TABLE
C. DROP TABLE
D. TRUNCATE TABLE
What is the purpose of the “JOIN” operation in SQL?
To merge rows from multiple tables based on a related column.
B. To filter data based on a condition.
C. To group data by a specified column.
D. To calculate aggregate values.
Which of the following statements is true about “NoSQL” databases?
They do not use SQL as a query language.
B. They store data in tables and rows.
C. They are more structured than relational databases.
D. They do not support data replication.
What is a “data dictionary” in a database?
A table containing the actual data of the database.
B. A set of SQL queries used to extract data from the database.
C. A collection of metadata that describes the structure of the database.
D. A backup of the entire database schema.
Which of the following describes “referential integrity” in a relational database?
Ensuring that no two tables contain the same data.
B. Ensuring that all foreign key values in a table correspond to valid values in the referenced table.
C. Ensuring that each column contains only unique values.
D. Ensuring that data is normalized to reduce redundancy.
What is the purpose of the “DISTINCT” keyword in SQL?
To remove duplicate rows from the query result.
B. To sort the query result in ascending order.
C. To calculate the total number of rows returned.
D. To group rows by a specific column.
What is the purpose of a “foreign key” in a relational database?
To uniquely identify a row within its own table.
B. To create relationships between different tables.
C. To speed up query performance.
D. To store large data in a compressed format.
Which of the following SQL statements would be used to change an existing value in a table?
DELETE
B. UPDATE
C. INSERT
D. ALTER
What is the difference between “DELETE” and “TRUNCATE” in SQL?
“DELETE” removes all rows, and “TRUNCATE” removes only specific rows.
B. “DELETE” can be rolled back, while “TRUNCATE” cannot be rolled back.
C. “DELETE” is faster than “TRUNCATE.”
D. “TRUNCATE” removes specific rows, while “DELETE” removes all rows.
What does the “UNION” operator do in SQL?
Combines rows from two or more SELECT statements, removing duplicates.
B. Joins rows from multiple tables based on a common column.
C. Limits the number of rows returned in a query.
D. Combines rows from two or more SELECT statements, keeping duplicates.
Which of the following is the main purpose of the “ORDER BY” clause in SQL?
To arrange the result set in a specified order.
B. To group rows based on certain conditions.
C. To filter rows based on a condition.
D. To combine rows from different tables.
In SQL, what is a “subquery”?
A query that is used to delete records from a table.
B. A query embedded within another query.
C. A query that updates multiple tables simultaneously.
D. A query that is used to create tables.
What does the “LIKE” operator do in SQL?
It checks for an exact match between two values.
B. It is used to compare a value against a pattern using wildcard characters.
C. It returns only distinct values.
D. It sorts the data in the result set.
Which of the following best describes the “denormalization” process in a database?
Splitting tables to minimize redundancy.
B. Combining tables to increase performance.
C. Removing foreign keys from the database.
D. Converting a relational database into a NoSQL database.
Which of the following is an example of an aggregate function in SQL?
COUNT()
B. SELECT()
C. INSERT()
D. JOIN()
Which of the following statements is true about SQL views?
Views cannot be updated.
B. Views are temporary tables that store actual data.
C. Views are virtual tables created based on a SELECT query.
D. Views are used to physically store large amounts of data.
Which of the following best defines the term “schema” in a database?
A collection of tables that define the structure of the database.
B. A set of SQL queries used to retrieve data from the database.
C. A file that stores actual data in a database.
D. A process of transforming data into a different format.
What is the purpose of the “UPDATE” statement in SQL?
To add new data to a table.
B. To modify existing data in a table.
C. To remove data from a table.
D. To create a new table.
What is the purpose of an index in a database?
To create relationships between tables.
B. To speed up query performance by allowing faster access to data.
C. To ensure data integrity.
D. To store data in a normalized format.
Which of the following is an example of a non-relational database?
MySQL
B. Oracle
C. MongoDB
D. PostgreSQL
What is the purpose of a “foreign key constraint” in a relational database?
To ensure that values in the foreign key column exist in the referenced table.
B. To guarantee the uniqueness of values in the primary key.
C. To define how data is indexed in the database.
D. To automatically generate values for primary keys.
Which of the following SQL commands is used to modify the structure of a table after it has been created?
ALTER TABLE
B. UPDATE TABLE
C. CREATE TABLE
D. MODIFY TABLE
What type of relationship does a “many-to-many” relationship describe in a relational database?
A relationship where each record in one table corresponds to one record in another table.
B. A relationship where each record in one table can correspond to multiple records in another table, and vice versa.
C. A relationship where records in one table correspond to none in another table.
D. A relationship where one table has only one column.
Which of the following is NOT a type of database normalization?
First Normal Form (1NF)
B. Second Normal Form (2NF)
C. Fourth Normal Form (4NF)
D. Sixth Normal Form (6NF)
In a relational database, which of the following ensures that every row in a table can be uniquely identified?
Composite key
B. Foreign key
C. Primary key
D. Candidate key
What is a “NULL” value in SQL?
A value that is automatically generated by the database.
B. A placeholder for missing or unknown data.
C. A default value assigned to a column.
D. A type of index used to speed up queries.
What is the purpose of the “GROUP BY” clause in SQL?
To filter records based on a condition.
B. To sort the results in ascending or descending order.
C. To group rows based on a shared column.
D. To create a new table from existing data.
Which of the following is true about “denormalization” in a database?
It is the process of combining tables to reduce data redundancy.
B. It involves splitting tables to minimize data redundancy.
C. It ensures the integrity of foreign key relationships.
D. It is used to increase the complexity of database queries.
Which of the following describes the purpose of a “database index”?
To create relationships between tables.
B. To speed up data retrieval operations.
C. To limit the number of records in a table.
D. To prevent duplicate data in the database.
Which SQL command is used to remove all rows from a table without removing the table itself?
REMOVE
B. DELETE
C. TRUNCATE
D. DROP
In SQL, what does the “DISTINCT” keyword do?
It removes duplicate rows from the result set.
B. It sorts the results in ascending order.
C. It combines rows from two different tables.
D. It limits the number of rows returned.
What is the purpose of the “INNER JOIN” clause in SQL?
To include all records from both tables, whether or not there is a match.
B. To return only matching rows between two tables.
C. To return all records from the first table and matching rows from the second table.
D. To filter records based on a condition.
Which of the following data types is most appropriate for storing a person’s name in a database?
INTEGER
B. DATE
C. VARCHAR
D. BOOLEAN
What is a “view” in SQL?
A temporary table that stores data for further use.
B. A stored procedure that modifies the database.
C. A virtual table created from a SELECT query to simplify complex queries.
D. A table that stores only unique data.
What is the difference between “WHERE” and “HAVING” clauses in SQL?
“WHERE” is used to filter records before grouping, while “HAVING” filters after grouping.
B. “WHERE” filters data after grouping, while “HAVING” filters before grouping.
C. “WHERE” is used for sorting results, while “HAVING” is used for filtering.
D. “WHERE” is used to join tables, while “HAVING” is used to calculate aggregate values.
What is the purpose of “referential integrity” in a relational database?
To ensure that all primary keys are unique.
B. To ensure that foreign key values correspond to valid primary keys in related tables.
C. To prevent the deletion of tables.
D. To create relationships between different databases.
What is an example of a “NoSQL” database?
Oracle
B. MongoDB
C. MySQL
D. PostgreSQL
What is the purpose of a “primary key” in a relational database?
To define how data is indexed.
B. To link two related tables.
C. To uniquely identify each record in a table.
D. To store large binary objects.
What is the main advantage of using “indexing” in a database?
It prevents duplicate records.
B. It speeds up query performance by allowing faster data access.
C. It reduces the need for foreign key constraints.
D. It simplifies table creation.
Which of the following is the correct syntax to change a column name in SQL?
ALTER COLUMN
B. UPDATE COLUMN
C. MODIFY COLUMN
D. RENAME COLUMN
What is the primary function of the “SELECT” statement in SQL?
To modify data in a table.
B. To insert data into a table.
C. To retrieve data from one or more tables.
D. To delete data from a table.
What does the “LIKE” operator do in SQL?
It checks for exact matches in string values.
B. It compares two tables for equality.
C. It matches values based on a specified pattern.
D. It orders results based on a condition.
What is the primary purpose of a “foreign key” in a relational database?
To uniquely identify records within a table.
B. To create relationships between tables.
C. To specify the data type of a column.
D. To automatically update related data when changes occur.
What type of database system is based on tables that relate to one another using keys?
NoSQL
B. Graph database
C. Relational database
D. Key-value store
In SQL, what does the “LIMIT” clause do?
Limits the number of columns returned.
B. Limits the number of rows returned by a query.
C. Limits the execution time of a query.
D. Limits the number of operations a user can perform on the database.
Which SQL command is used to remove a database schema or table structure, along with all data?
DROP
B. DELETE
C. TRUNCATE
D. REMOVE
What is a “schema” in a relational database?
A collection of related data within the database.
B. A file used for storing data in a table.
C. The structure or organization of the database.
D. A command used to query the database.
What is the main advantage of “database normalization”?
It increases the performance of SQL queries.
B. It reduces redundancy and organizes data efficiently.
C. It simplifies complex database designs.
D. It ensures that foreign keys are always present in a table.
Which of the following is NOT an example of a relational database management system (RDBMS)?
MySQL
B. SQLite
C. MongoDB
D. PostgreSQL
Which SQL statement is used to retrieve data from a database?
INSERT
B. SELECT
C. DELETE
D. UPDATE
What is the purpose of a “stored procedure” in SQL?
To execute a set of SQL queries that can be called and reused multiple times.
B. To store data permanently in a table.
C. To define the structure of a database.
D. To optimize query performance by indexing data.
What type of relationship is represented by a “one-to-many” relationship in a relational database?
One record in a table corresponds to only one record in another table.
B. One record in a table corresponds to multiple records in another table.
C. Many records in a table correspond to only one record in another table.
D. Records in both tables are identical.
Which of the following operations can be performed using “Data Manipulation Language (DML)”?
Creating and deleting tables.
B. Defining data structures.
C. Querying, inserting, updating, and deleting data in tables.
D. Creating indexes for a database.
What does the “HAVING” clause do in SQL?
Filters records before grouping them.
B. Groups records by specified columns.
C. Filters records after grouping them.
D. Sorts the records in ascending or descending order.
Which of the following is a characteristic of a “relational database”?
Data is stored in a hierarchy of records.
B. Data is stored in tables with rows and columns.
C. Data is stored as key-value pairs.
D. Data is stored in graphs of nodes and relationships.
Which of the following is the correct SQL syntax to add a new column to an existing table?
ALTER TABLE table_name ADD COLUMN column_name datatype;
B. MODIFY TABLE table_name ADD column_name datatype;
C. CHANGE TABLE table_name ADD column_name datatype;
D. UPDATE TABLE table_name ADD column_name datatype;
In a “many-to-many” relationship, what is typically used to resolve the relationship?
A foreign key
B. A join table or junction table
C. A view
D. A trigger
Which of the following SQL keywords is used to remove a table from a database?
DELETE
B. DROP
C. TRUNCATE
D. REMOVE
What is the purpose of the “ORDER BY” clause in SQL?
To sort the result set in a specific order.
B. To group records by one or more columns.
C. To limit the number of records returned.
D. To calculate aggregate values for records.
In SQL, what is the default sorting order when using the “ORDER BY” clause?
Ascending (ASC)
B. Descending (DESC)
C. Random
D. No sorting order is applied.
What is a “composite key” in a relational database?
A key that consists of two or more columns to uniquely identify a record.
B. A unique identifier generated by the database.
C. A primary key combined with a foreign key.
D. A key that is automatically generated by the system.
Which of the following is a characteristic of “NoSQL” databases?
They are always relational.
B. They use structured query language (SQL).
C. They are optimized for handling large volumes of unstructured or semi-structured data.
D. They are slower in processing queries compared to relational databases.
Which of the following operations is used to remove all records from a table but keep the table structure intact?
REMOVE
B. DELETE
C. TRUNCATE
D. DROP
In a relational database, which of the following defines the relationships between tables?
Views
B. Foreign keys
C. Triggers
D. Indexes
What does the “JOIN” clause do in SQL?
Combines rows from two or more tables based on a related column.
B. Combines columns from two tables.
C. Groups data into distinct values.
D. Sorts the rows in the result set.
Which of the following is an advantage of using a “view” in SQL?
It stores data permanently in the database.
B. It speeds up the database query execution.
C. It simplifies complex queries by providing an abstraction layer.
D. It automatically updates data in the underlying table.
What does the SQL statement “UPDATE table_name SET column_name = value WHERE condition” do?
It adds new rows to the table.
B. It removes rows from the table.
C. It modifies existing data in the table.
D. It creates a new table based on the specified data.
What is a “transaction” in the context of a relational database?
A command to retrieve data from a database.
B. A series of operations executed as a single unit to ensure consistency and integrity.
C. A function that aggregates values from a table.
D. A temporary structure used to store query results.
What does the “ROLLBACK” command do in SQL?
It commits the transaction and saves changes permanently.
B. It undoes changes made during the current transaction.
C. It deletes all rows from the table.
D. It restarts the current transaction.
Which of the following operations can be performed by “Data Definition Language (DDL)”?
Inserting data into a table.
B. Modifying data in a table.
C. Creating and deleting database objects like tables and indexes.
D. Querying data from a table.
What is the “REFERENCES” keyword used for in SQL?
To specify a foreign key constraint that references another table.
B. To define the data type of a column.
C. To retrieve data from a table.
D. To define primary keys for a table.
Which of the following is the purpose of the “IN” operator in SQL?
It returns the number of rows in the result set.
B. It checks if a value is within a specified list of values.
C. It joins tables based on a common column.
D. It limits the number of rows returned.
What is the correct way to find the highest salary in a “employees” table using SQL?
SELECT MAX(salary) FROM employees;
B. SELECT MIN(salary) FROM employees;
C. SELECT salary FROM employees WHERE salary = MAX(salary);
D. SELECT salary FROM employees ORDER BY salary DESC LIMIT 1;
Which SQL function would you use to calculate the average value of a numeric column?
COUNT()
B. AVG()
C. SUM()
D. MAX()
In SQL, which of the following is used to check for pattern matches in string data?
LIKE
B. EQUAL
C. BETWEEN
D. IN
What is an “index” in a relational database?
A backup of the database.
B. A way to optimize the database by storing copies of frequently accessed data.
C. A way to group data into distinct values.
D. A reference to a foreign key.
Which of the following is a disadvantage of using “denormalization” in a database?
It can lead to increased redundancy and storage requirements.
B. It reduces query performance by making joins slower.
C. It requires more complex queries to be written.
D. It introduces data integrity issues.
What is the purpose of the “DISTINCT” keyword in SQL?
It retrieves only distinct (unique) values from a column.
B. It joins two tables together.
C. It filters records based on a condition.
D. It limits the number of rows returned.
What is a “subquery” in SQL?
A query that is nested within another query.
B. A function that sums values in a column.
C. A query that deletes data from a table.
D. A query that updates data in a table.