Table of Contents
Database Management System MCQs Set-1
- Which of the following is a type of DBMS?
a) Hierarchical
b) Network
c) Relational
d) All of the above - In a relational database, a row is also known as a:
a) Record
b) Field
c) Table
d) Key - The primary key in a database:
a) Must be unique
b) Can have duplicate values
c) Cannot be null
d) Both a and c - SQL stands for:
a) Structured Query Language
b) Simple Query Language
c) Sequential Query Language
d) Syntax Query Language - A collection of related data entries is called a:
a) Field
b) Table
c) Database
d) Schema - Which SQL command is used to remove a table from a database?
a) DELETE
b) DROP
c) REMOVE
d) TRUNCATE - The process of ensuring data accuracy and consistency in a database is called:
a) Indexing
b) Normalization
c) Redundancy
d) Denormalization - In which language is a view defined?
a) Data Definition Language (DDL)
b) SQL
c) Assembly
d) Java - A relation is in the first normal form if it contains:
a) Redundant data
b) Repeating groups
c) Atomic values
d) Derived attributes - What is the full form of ACID in databases?
a) Atomicity, Consistency, Isolation, Durability
b) Accuracy, Consistency, Integrity, Data
c) Association, Coordination, Integrity, Durability
d) Atomicity, Consistency, Isolation, Durability - Which of the following is not a valid SQL aggregate function?
a) SUM
b) AVG
c) MULT
d) MAX - Which of the following is a valid data type in SQL?
a) INTEGER
b) VARCHAR
c) DATE
d) All of the above - The entity integrity constraint states that:
a) Every table must have a foreign key
b) No primary key value can be null
c) Foreign keys can be null
d) Every table must have a candidate key - Which of the following operations is not part of the CRUD operations?
a) Create
b) Search
c) Update
d) Delete - What does DML stand for in databases?
a) Database Manipulation Language
b) Data Manipulation Language
c) Data Management Language
d) Data Modification Language
Database Management System MCQs Set-2
- Which command is used to modify an existing row in a table?
a) UPDATE
b) ALTER
c) MODIFY
d) INSERT - Which of the following is not a type of join in SQL?
a) INNER JOIN
b) OUTER JOIN
c) LEFT JOIN
d) RIGHT JOIN - Which keyword is used to retrieve unique values from a column in SQL?
a) DISTINCT
b) UNIQUE
c) SEPARATE
d) DIFFERENT - The default sorting order in SQL is:
a) Ascending
b) Descending
c) Random
d) Alphanumeric - Which SQL function is used to count the number of rows in a table?
a) TOTAL
b) COUNT
c) SUM
d) AVERAGE - Which of the following is not a DML statement?
a) SELECT
b) DELETE
c) INSERT
d) CREATE - In an ER diagram, a weak entity is represented by:
a) Double rectangle
b) Double oval
c) Double diamond
d) Double square - What is the purpose of indexing in a database?
a) To speed up data retrieval
b) To slow down data retrieval
c) To delete data
d) To modify data - Which clause is used to filter the records in an SQL query?
a) WHERE
b) ORDER BY
c) GROUP BY
d) HAVING - Which SQL statement is used to add a new record to a table?
a) INSERT INTO
b) ADD
c) CREATE
d) APPEND - What does SQL injection exploit?
a) Vulnerabilities in SQL queries
b) Strong security features of SQL
c) Network encryption
d) Database normalization - A primary key that consists of two or more attributes is called a:
a) Candidate key
b) Composite key
c) Foreign key
d) Simple key - Which command is used to remove all rows from a table without removing the table itself?
a) TRUNCATE
b) DELETE
c) DROP
d) REMOVE - Which type of database model represents data in the form of objects, as in object-oriented programming?
a) Object-oriented database
b) Relational database
c) Network database
d) Hierarchical database - In SQL, the wildcard character
%
is used to:
a) Represent zero or more characters
b) Represent a single character
c) Represent a digit
d) Represent a space
Database Management System MCQs Set-3
- Which of the following is a binary operation in relational algebra?
a) JOIN
b) SELECT
c) PROJECT
d) RENAME - Which of the following SQL clauses is used to group records that have the same values in specified columns?
a) ORDER BY
b) GROUP BY
c) HAVING
d) WHERE - Which type of join returns all rows when there is a match in either left or right table?
a) INNER JOIN
b) FULL JOIN
c) LEFT JOIN
d) RIGHT JOIN - A database is said to be in which normal form if it is in 2NF and contains no transitive dependencies?
a) 1NF
b) 2NF
c) 3NF
d) BCNF - What is the command used to rename a table in SQL?
a) RENAME
b) ALTER
c) MODIFY
d) UPDATE - What is a stored procedure?
a) A subroutine stored in the database
b) A database schema
c) A precompiled collection of SQL statements
d) A user interface to a database - Which of the following is a benefit of using a database management system?
a) Data redundancy
b) Data integrity
c) Data inconsistency
d) Data isolation - What is the purpose of the HAVING clause in SQL?
a) To filter records after aggregation
b) To sort records
c) To join tables
d) To group records - What is the highest level of isolation in transaction management?
a) Serializable
b) Repeatable read
c) Read committed
d) Read uncommitted - Which SQL statement is used to change the structure of a table?
a) ALTER TABLE
b) MODIFY TABLE
c) UPDATE TABLE
d) CHANGE TABLE - The default value of a column can be set using:
a) DEFAULT
b) SET
c) ADD
d) INSERT - What is the term for a software system that enables the creation, maintenance, and use of databases?
a) DBMS
b) Database management system
c) Data management system
d) Structured management system - What type of key is used to uniquely identify a record in a table, other than the primary key?
a) Alternate key
b) Foreign key
c) Composite key
d) Candidate key - Which SQL clause is used to combine the result-set of two or more SELECT statements?
a) UNION
b) JOIN
c) INTERSECT
d) EXCEPT - In a database, what is a schema?
a) A row in a table
b) A column in a table
c) The structure of a database
d) A type of query
Database Management System MCQs Set-4
- Which SQL function returns the largest value from the selected column?
a) MIN
b) MAX
c) SUM
d) AVG - Which of the following is used to uniquely identify a record in a table?
a) Primary key
b) Foreign key
c) Composite key
d) Super key - In which SQL clause do you specify the conditions for row selection?
a) WHERE
b) FROM
c) SELECT - In a database, a relationship is represented by a:
a) Foreign key
b) Primary key
c) Unique key
d) Index - The process of combining two or more tables based on a common field is called:
a) Union
b) Join
c) Intersection
d) Select - Which of the following is a valid SQL data type?
a) INTEGER
b) CHAR
c) DATE
d) All of the above - The command to remove a column from an existing table in SQL is:
a) ALTER TABLE DROP COLUMN
b) DELETE COLUMN
c) REMOVE COLUMN
d) TRUNCATE COLUMN - Which SQL keyword is used to retrieve data from a database?
a) SELECT
b) GET
c) RETRIEVE
d) FETCH - Which of the following is not a feature of DBMS?
a) Concurrency control
b) Data integrity
c) File processing
d) Security - In a database, what is the term for a collection of interrelated data?
a) Table
b) Database
c) Record
d) Field - Which SQL command is used to create a new table?
a) CREATE TABLE
b) ADD TABLE
c) NEW TABLE
d) INSERT TABLE - Which clause is used to limit the number of rows returned by a query in SQL?
a) LIMIT
b) RESTRICT
c) STOP
d) BOUNDARY - What type of constraint ensures that the values in a column are within a specified range?
a) CHECK
b) PRIMARY KEY
c) UNIQUE
d) FOREIGN KEY - Which database operation allows you to extract and display data from one or more tables?
a) SELECT
b) INSERT
c) DELETE
d) UPDATE - In relational databases, what is the term for a unique combination of fields that can be used to identify a record?
a) Composite key
b) Foreign key
c) Super key
d) Unique key
Database Management System MCQs Set-5
- Which operation in relational algebra corresponds to the SQL command SELECT?
a) Projection
b) Selection
c) Union
d) Intersection - In SQL, which command is used to remove duplicate records from a result set?
a) UNIQUE
b) DISTINCT
c) REMOVE
d) CLEAR - Which type of join returns only the matching rows from both tables?
a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
d) FULL JOIN - What does the SQL ORDER BY clause do?
a) Sorts the result set
b) Filters the result set
c) Groups the result set
d) Limits the result set - What is the primary function of a database index?
a) Improve query performance
b) Ensure data integrity
c) Create relationships between tables
d) Enforce primary key constraints - Which SQL function calculates the average value of a numeric column?
a) SUM
b) AVG
c) MAX
d) MIN - In a normalized database, which normal form eliminates all transitive dependencies?
a) 3NF
b) 1NF
c) 2NF
d) BCNF - What is the purpose of the SQL HAVING clause?
a) To filter groups of rows
b) To filter individual rows
c) To sort the result set
d) To join multiple tables - Which SQL keyword is used to aggregate data across rows?
a) GROUP BY
b) ORDER BY
c) WHERE
d) DISTINCT - Which command is used to permanently remove a table from a database?
a) DROP TABLE
b) DELETE TABLE
c) TRUNCATE TABLE
d) REMOVE TABLE - Which SQL function is used to add up the values in a numeric column?
a) SUM
b) COUNT
c) AVG
d) MAX - In relational databases, a candidate key is:
a) A set of attributes that can uniquely identify a record
b) Always the primary key
c) A key used for indexing
d) A key used to relate two tables - What is the term for a query inside another query in SQL?
a) Subquery
b) Nested query
c) Inner query
d) Subset query - Which SQL clause is used to sort the result set of a query?
a) ORDER BY
b) GROUP BY
c) WHERE
d) HAVING - Which of the following is not a NoSQL database?
a) MongoDB
b) Cassandra
c) MySQL
d) Couchbase
Database Management System MCQs Set-6
- What type of key is used to establish and enforce a link between two tables?
a) Foreign key
b) Primary key
c) Composite key
d) Super key - Which SQL clause is used to filter rows before grouping them?
a) WHERE
b) HAVING
c) ORDER BY
d) GROUP BY - In SQL, which command is used to modify the existing structure of a table?
a) ALTER TABLE
b) UPDATE TABLE
c) MODIFY TABLE
d) CHANGE TABLE - Which SQL keyword is used to specify conditions that a query’s results must satisfy?
a) WHERE
b) ORDER BY
c) HAVING
d) GROUP BY - What does ACID stand for in the context of database transactions?
a) Accuracy, Consistency, Isolation, Durability
b) Atomicity, Consistency, Isolation, Durability
c) Access, Control, Integrity, Durability
d) Atomicity, Control, Isolation, Data - In which scenario would you use a LEFT JOIN?
a) To retrieve only matching rows from both tables
b) To retrieve all rows from the left table and matching rows from the right table
c) To retrieve all rows from both tables
d) To retrieve rows that do not match in the right table - Which SQL function returns the current date and time?
a) CURRENT_DATE
b) NOW()
c) GETDATE()
d) TODAY() - What is the purpose of a database transaction?
a) To execute multiple queries simultaneously
b) To ensure that a series of operations are executed as a single unit of work
c) To manage user access to the database
d) To improve query performance - Which SQL keyword is used to check for a specified pattern in a column?
a) MATCH
b) LIKE
c) CHECK
d) FIND - Which of the following is a characteristic of a well-designed relational database?
a) High redundancy
b) Minimal redundancy
c) Lack of indexes
d) No normalization - Which clause is used in SQL to specify a condition on an aggregate function?
a) WHERE
b) HAVING
c) GROUP BY
d) ORDER BY - Which SQL command is used to remove rows from a table based on a condition?
a) DELETE
b) DROP
c) REMOVE
d) CLEAR - What does the term “schema” refer to in a database?
a) The data stored in the database
b) The structure of the database, including tables, relationships, and constraints
c) A query that retrieves data
d) The software used to manage the database - Which of the following is a valid SQL command to change a column name?
a) ALTER TABLE table_name RENAME COLUMN old_name TO new_name
b) MODIFY COLUMN
c) UPDATE COLUMN
d) CHANGE COLUMN - Which type of index is automatically created by the database for a primary key?
a) Clustered index
b) Non-clustered index
c) Composite index
d) Unique index
Database Management System MCQs Set-7
- Which of the following operations would cause a loss of data integrity?
a) Deleting a record that is referenced by a foreign key
b) Updating a record
c) Inserting a record
d) Selecting a record - In SQL, which command is used to create a new database?
a) CREATE DATABASE
b) NEW DATABASE
c) ADD DATABASE
d) INIT DATABASE - Which SQL function is used to count the number of records in a table?
a) SUM
b) COUNT
c) AVERAGE
d) MAX - In a relational database, a table is also known as a:
a) Relation b) Attribute
c) Domain
d) Tuple - Which of the following is an example of a DDL (Data Definition Language) command?
a) CREATE
b) SELECT
c) INSERT
d) UPDATE - Which of the following is a property of a transaction in a database?
a) Consistency
b) Atomicity
c) Durability
d) All of the above - In an SQL query, which clause is used to return records that meet a specified condition?
a) WHERE
b) GROUP BY
c) HAVING
d) ORDER BY - What is the main purpose of using the SQL UNION operator?
a) To join tables
b) To combine the result sets of two or more SELECT statements
c) To find the intersection of two result sets
d) To delete rows - Which of the following SQL commands is used to add a new column to an existing table?
a) ALTER TABLE ADD COLUMN
b) UPDATE TABLE
c) INSERT INTO
d) MODIFY TABLE - What is a key benefit of database normalization?
a) Reduction of data redundancy
b) Increase in query performance
c) Simplification of queries
d) Increase in data redundancy - Which SQL command is used to remove a table from the database?
a) DROP TABLE
b) DELETE TABLE
c) CLEAR TABLE
d) REMOVE TABLE - In a database, what is a trigger?
a) A type of index
b) A procedure that automatically executes in response to certain events on a table or view
c) A query that retrieves data
d) A rule that enforces data integrity - Which of the following is an example of an SQL aggregate function?
a) SUM
b) WHERE
c) SELECT
d) JOIN - What is a non-clustered index in SQL?
a) An index that determines the physical order of data
b) An index that creates a logical order independent of the physical order
c) An index that is automatically created by the database
d) An index that stores data in the database - Which SQL keyword is used to remove duplicate rows from a result set?
a) UNIQUE
b) DISTINCT
c) DELETE
d) CLEAR
Database Management System MCQs Set-8
- Which SQL command is used to combine the results of two or more SELECT queries and return only distinct rows?
a) INTERSECT
b) UNION
c) JOIN
d) CONCATENATE - In SQL, what does the term “null” represent?
a) Zero
b) An absence of value
c) An empty string
d) A negative number - What is the purpose of the SQL ROLLBACK command?
a) To execute a query
b) To undo changes made during the current transaction
c) To save changes
d) To commit changes - Which of the following is not an SQL data type?
a) INTEGER
b) VARCHAR
c) DATE
d) PIXEL - What is the purpose of the SQL IN operator?
a) To specify multiple possible values for a column
b) To check for a specific value
c) To combine two queries
d) To join tables - In SQL, which command is used to remove a column from an existing table?
a) DELETE COLUMN
b) ALTER TABLE DROP COLUMN
c) REMOVE COLUMN
d) CLEAR COLUMN - What is a composite key in a relational database?
a) A key that consists of two or more columns to uniquely identify a row
b) A key that is automatically generated
c) A key that links two tables
d) A key that is used for indexing - Which of the following is a DML (Data Manipulation Language) command?
a) INSERT
b) CREATE
c) ALTER
d) DROP - What is a foreign key in a database?
a) A key that uniquely identifies a record within its table
b) A key used to link two tables together
c) A key that is always null
d) A key that stores metadata - Which SQL function returns the number of rows in a result set?
a) SUM
b) COUNT
c) AVG
d) MAX - In SQL, what is the purpose of the JOIN clause?
a) To combine the result sets of two queries
b) To combine rows from two or more tables based on a related column
c) To retrieve distinct rows
d) To delete rows - Which of the following is an SQL constraint?
a) SELECT
b) UNIQUE
c) INSERT
d) DROP - What does the SQL TRUNCATE command do?
a) Deletes the table structure
b) Removes all rows from a table, but the structure remains
c) Drops the table entirely
d) Removes duplicate rows - Which of the following SQL functions is used to concatenate two strings?
a) CONCAT()
b) JOIN()
c) MERGE()
d) UNION() - Which SQL statement is used to update data in a database?
a) INSERT
b) UPDATE
c) MODIFY
d) ALTER
Database Management System MCQs Set-9
- Which SQL keyword is used to filter records in a result set?
a) WHERE
b) GROUP BY
c) ORDER BY
d) LIMIT - What is the purpose of the SQL command COMMIT?
a) To start a transaction
b) To save changes made during the current transaction
c) To rollback changes
d) To select data - Which type of join returns all records from the left table and the matched records from the right table?
a) INNER JOIN
b) FULL JOIN
c) LEFT JOIN
d) RIGHT JOIN - Which SQL clause is used to limit the number of rows returned in a query?
a) LIMIT
b) RESTRICT
c) GROUP BY
d) HAVING - What is a view in SQL?
a) A physical table
b) A virtual table based on the result set of a query
c) A type of index
d) A foreign key - Which SQL clause is used to group rows that have the same values in specified columns?
a) GROUP BY
b) ORDER BY
c) WHERE
d) JOIN - In which scenario is the SQL HAVING clause used?
a) To filter groups after aggregation
b) To filter rows before aggregation
c) To sort rows
d) To join tables - Which SQL function is used to find the minimum value in a column?
a) MIN()
b) MAX()
c) LEAST()
d) LOWER() - What is a candidate key in a relational database?
a) A key that is used for foreign key relationships
b) A key that is always unique
c) A key that could be chosen as a primary key
d) A key that contains null values - In SQL, what is the result of the UNION operator?
a) A result set that combines the results of two or more queries and removes duplicates
b) A result set that returns only the intersection of two queries
c) A result set that contains all records from both queries
d) A result set that returns the difference between two queries - Which of the following is not a valid SQL constraint?
a) UNIQUE
b) CHECK
c) MODIFY
d) FOREIGN KEY - What is the difference between DELETE and TRUNCATE commands in SQL?
a) DELETE removes rows one by one and can have a WHERE clause; TRUNCATE removes all rows at once and cannot have a WHERE clause
b) DELETE removes the entire table; TRUNCATE removes specific rows
c) DELETE is a DDL command; TRUNCATE is a DML command
d) DELETE cannot be rolled back; TRUNCATE can be rolled back - What is the purpose of the SQL command ALTER TABLE?
a) To delete rows from a table
b) To create a new table
c) To modify the structure of an existing table
d) To retrieve data from a table - Which SQL function can be used to return the remainder of a division operation?
a) MOD()
b) REMAINDER()
c) DIV()
d) FLOOR() - What does the SQL keyword EXISTS do?
a) Tests for the existence of any record in a subquery
b) Checks if a column exists
c) Deletes existing records
d) Returns the first record in a result set
Database Management System MCQs Set-10
- Which SQL statement is used to remove rows from a table without deleting the table itself?
a) DROP
b) DELETE
c) TRUNCATE
d) REMOVE - In SQL, what is the purpose of the GROUP BY clause?
a) To sort records
b) To aggregate data across multiple records by grouping them based on one or more columns
c) To filter records
d) To join records - What is the function of the SQL command GRANT?
a) To provide specific privileges to users or roles
b) To revoke privileges
c) To create a new user
d) To delete a user - Which of the following SQL statements is used to retrieve data from a database?
a) SELECT
b) INSERT
c) UPDATE
d) DELETE - What is the primary function of the SQL HAVING clause?
a) To join tables
b) To sort results
c) To filter groups after aggregation
d) To filter individual rows - Which SQL function is used to calculate the total sum of a numeric column?
a) AVG()
b) SUM()
c) COUNT()
d) MAX() - What does the SQL term “primary key” refer to?
a) A column that can have duplicate values
b) A column or set of columns that uniquely identifies each row in a table
c) A column that links two tables
d) A column that stores large objects - Which of the following is a DCL (Data Control Language) command in SQL?
a) SELECT
b) GRANT
c) UPDATE
d) DELETE - Which SQL function is used to return the highest value in a column?
a) MIN()
b) MAX()
c) AVG()
d) COUNT() - What is a stored procedure in SQL?
a) A set of SQL statements that can be executed as a single unit
b) A function that returns a value
c) A command that creates a new table
d) A query that retrieves data - What does the SQL command RENAME TABLE do?
a) Modifies the structure of the table
b) Changes the name of an existing table
c) Deletes the table
d) Adds a new column to the table - Which of the following SQL keywords is used to remove duplicates from a result set?
a) DELETE
b) DISTINCT
c) REMOVE
d) UNIQUE - What is a database trigger?
a) A type of index
b) A procedure that automatically executes in response to certain events on a table
c) A query that retrieves data
d) A rule that enforces data integrity - Which SQL command is used to modify existing data in a database?
a) UPDATE
b) INSERT
c) DELETE
d) SELECT - In SQL, what is a schema?
a) The structure or organization of a database
b) The data stored in the database
c) A query that retrieves data
d) The software used to manage the database
Database Management System MCQs Set-11
- What does the SQL command CREATE TABLE do?
a) Updates the structure of a table
b) Creates a new table in the database
c) Deletes an existing table
d) Insert data into a table - Which SQL command is used to retrieve distinct values from a column?
a) WHERE
b) DISTINCT
c) UNIQUE
d) GROUP BY - What is the purpose of the SQL HAVING clause?
a) To filter rows before aggregation
b) To filter groups after aggregation
c) To join tables
d) To sort rows - In SQL, what does the term “schema” refer to?
a) The data stored in the database
b) The structure or organization of a database
c) A query that retrieves data
d) The software used to manage the database - Which SQL function is used to calculate the average value of a numeric column?
a) SUM()
b) AVG()
c) COUNT()
d) MIN() - What is the purpose of a foreign key in a database?
a) To link two tables together
b) To store large objects
c) To enforce unique values
d) To index data - Which SQL statement is used to add a new row to a table?
a) INSERT INTO
b) UPDATE
c) DELETE
d) ALTER TABLE - What does the SQL command DROP TABLE do?
a) Removes all rows from a table but keeps the structure
b) Deletes a table and its structure from the database
c) Deletes specific rows from a table
d) Modifies the structure of a table - In SQL, what is a join?
a) A method to combine rows from two or more tables based on a related column
b) A function that aggregates data
c) A command to remove duplicates
d) A type of index - What is the result of the SQL UNION ALL operator?
a) A result set that combines the results of two or more queries, including duplicates
b) A result set that removes duplicates
c) A result set that only includes the intersection of two queries
d) A result set that returns the difference between two queries - What is the main purpose of SQL constraints?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store data in a specific order - Which SQL command is used to modify the structure of an existing table?
a) UPDATE
b) ALTER TABLE
c) INSERT
d) DROP TABLE - In SQL, which function returns the current date and time?
a) SYSDATE()
b) NOW()
c) CURDATE()
d) GETDATE() - What is the purpose of the SQL LIMIT clause?
a) To restrict the number of rows returned by a query
b) To limit the number of columns
c) To limit the size of the database
d) To limit the number of joins - Which of the following is an example of a SQL DML (Data Manipulation Language) command?
a) CREATE TABLE
b) UPDATE
c) DROP DATABASE
d) ALTER TABLE
Database Management System MCQs Set-12
- What does the SQL command SELECT do?
a) Retrieves data from a database
b) Modifies data in a database
c) Deletes data from a database
d) Creates a new database - Which SQL keyword is used to return only unique values?
a) WHERE
b) DISTINCT
c) UNIQUE
d) GROUP BY - What is the purpose of the SQL ORDER BY clause?
a) To sort the result set by one or more columns
b) To filter the result set
c) To group the result set
d) To limit the number of rows in the result set - In SQL, what does the COUNT() function do?
a) Returns the number of rows that match a specified condition
b) Calculates the sum of a column
c) Finds the maximum value in a column
d) Finds the minimum value in a column - What is the primary key in a relational database?
a) A key that links two tables
b) A column or set of columns that uniquely identifies each row in a table
c) A key that contains null values
d) A key that is automatically generated - Which SQL clause is used to filter records before they are grouped?
a) HAVING
b) WHERE
c) ORDER BY
d) GROUP BY - What is a trigger in SQL?
a) A procedure that automatically executes in response to certain events on a table or view
b) A query that retrieves data
c) A rule that enforces data integrity
d) A type of index - What does the SQL command UPDATE do?
a) Modifies existing data in a table
b) Deletes data from a table
c) Adds a new row to a table
d) Creates a new table - In SQL, what is the function of the JOIN clause?
a) To combine rows from two or more tables based on a related column
b) To remove duplicates
c) To filter rows based on a condition
d) To sort the result set - What is the purpose of the SQL HAVING clause?
a) To join tables
b) To filter groups after aggregation
c) To sort rows
d) To filter individual rows - Which SQL command is used to delete all rows from a table without removing the table structure?
a) TRUNCATE TABLE
b) DELETE
c) DROP TABLE
d) REMOVE - What does the SQL command RENAME TABLE do?
a) Changes the name of an existing table
b) Modifies the structure of the table
c) Deletes the table
d) Adds a new column to the table - In SQL, what is a composite key?
a) A key that is always unique
b) A key that consists of two or more columns to uniquely identify a row
c) A key that is automatically generated
d) A key that links two tables - What is the purpose of the SQL IN operator?
a) To join tables
b) To specify multiple possible values for a column
c) To filter rows
d) To combine two queries - Which SQL function is used to return the maximum value in a column?
a) MIN()
b) MAX()
c) AVG()
d) COUNT()
Database Management System MCQs Set-13
- What is a database index?
a) A tool for aggregating data
b) A data structure that improves the speed of data retrieval operations
c) A key that uniquely identifies a record
d) A command to join two tables - In SQL, which function is used to count the number of rows in a table?
a) COUNT()
b) SUM()
c) MAX()
d) AVG() - What is the purpose of the SQL SELECT DISTINCT statement?
a) To return only distinct (different) values
b) To return all values, including duplicates
c) To filter rows
d) To join tables - Which SQL command is used to delete specific rows from a table?
a) DELETE
b) TRUNCATE
c) DROP
d) REMOVE - What does the SQL command COMMIT do?
a) Starts a new transaction
b) Saves all changes made during the current transaction
c) Reverts changes made during the current transaction
d) Deletes data from the database - What is a candidate key in a database?
a) A key that is always unique
b) A key that could be chosen as a primary key
c) A key that contains null values
d) A key used for indexing - What is the purpose of the SQL command GRANT?
a) To delete a user
b) To provide specific privileges to users or roles
c) To revoke privileges
d) To create a new user - What does the SQL term “null” represent?
a) Zero
b) An absence of value
c) An empty string
d) A negative number - Which SQL function is used to find the minimum value in a column?
a) MIN()
b) MAX()
c) LEAST()
d) LOWER() - What is the main purpose of database normalization?
a) To reduce data redundancy and improve data integrity
b) To increase query performance
c) To simplify queries
d) To increase data redundancy - Which SQL clause is used to group rows that have the same values in specified columns? a) GROUP BY
b) ORDER BY
c) WHERE
d) JOIN - What does the SQL function TRUNCATE do?
a) Removes all rows from a table but keeps the structure
b) Deletes the entire table
c) Removes specific rows from a table
d) Modifies the structure of a table - Which of the following SQL statements is used to modify the structure of an existing table?
a) INSERT
b) DELETE
c) ALTER TABLE
d) CREATE TABLE - What does the SQL JOIN clause do?
a) Combines rows from two or more tables based on a related column
b) Aggregates data
c) Filters rows
d) Deletes rows - What is the result of using the SQL UNION operator?
a) A result set that combines the results of two or more queries, including duplicates
b) A result set that combines the results of two or more queries and removes duplicates
c) A result set that returns only the intersection of two queries
d) A result set that returns the difference between two queries
Database Management System MCQs Set-14
- What is the purpose of the SQL DISTINCT keyword?
a) To sort results
b) To remove duplicates
c) To return unique values
d) To join tables - In SQL, what does the function MAX() do?
a) Returns the highest value in a column
b) Returns the lowest value in a column
c) Calculates the average value
d) Counts the number of rows - Which SQL command is used to create a new database?
a) ALTER DATABASE
b) CREATE DATABASE
c) DROP DATABASE
d) MODIFY DATABASE - What does the SQL function SUM() do?
a) Calculates the total sum of a numeric column
b) Finds the minimum value
c) Finds the maximum value
d) Counts the number of rows - What is the purpose of the SQL LIKE operator?
a) To search for a specified pattern in a column
b) To join tables
c) To filter rows
d) To aggregate data - Which SQL statement is used to create an index on a table?
a) INSERT
b) CREATE INDEX
c) ALTER TABLE
d) DROP INDEX - What is a view in SQL?
a) A physical table
b) A virtual table based on the result set of a query
c) A type of index
d) A constraint - In SQL, what is the purpose of the REVOKE command?
a) To provide privileges
b) To remove privileges from users or roles
c) To create a new user
d) To delete a user - What does the SQL command TRUNCATE TABLE do?
a) Removes all rows from a table without removing the table structure
b) Deletes the table
c) Deletes specific rows from the table
d) Modifies the table structure - Which SQL keyword is used to specify a condition in a query?
a) JOIN
b) WHERE
c) ORDER BY
d) GROUP BY - What is the purpose of the SQL UPDATE command?
a) To insert new data
b) To delete data
c) To modify existing data in a table
d) To create a new table - What is a primary key in a database?
a) A key that links two tables
b) A column or set of columns that uniquely identifies each row in a table
c) A key that contains null values
d) A key used for indexing - Which SQL function is used to concatenate two strings?
a) JOIN()
b) MERGE()
c) UNION()
d) CONCAT() - What does the SQL GROUP BY clause do?
a) Groups rows that have the same values in specified columns
b) Sorts rows
c) Filters rows
d) Joins tables - What is the purpose of the SQL command ALTER TABLE?
a) To delete rows from a table
b) To create a new table
c) To modify the structure of an existing table
d) To retrieve data from a table
Database Management System MCQs Set-15
- What is the function of the SQL DROP command?
a) To delete specific rows from a table
b) To remove a table, database, or index from the database
c) To modify the structure of a table
d) To create a new table - What does the SQL function ROUND() do?
a) Rounds a numeric field to the number of decimal places specified
b) Finds the maximum value in a column
c) Counts the number of rows
d) Returns the sum of a column - Which SQL statement is used to add a new column to an existing table?
a) UPDATE TABLE
b) INSERT INTO
c) ALTER TABLE ADD COLUMN
d) MODIFY TABLE - What is a foreign key in a relational database?
a) A key that uniquely identifies a record within its table
b) A key used to link two tables together
c) A key that is always null
d) A key that stores metadata - What is the purpose of the SQL DELETE command?
a) To remove a table
b) To remove all rows from a table
c) To remove specific rows from a table
d) To modify the structure of a table - Which SQL clause is used to sort the results of a query?
a) GROUP BY
b) WHERE
c) ORDER BY
d) HAVING - What is a database schema?
a) The data stored in the database
b) The software used to manage the database
c) The structure or organization of a database
d) A query that retrieves data - What does the SQL function LOWER() do?
a) Converts all characters in a string to lowercase
b) Converts all characters in a string to uppercase
c) Finds the minimum value in a column
d) Finds the maximum value in a column - What is a composite key in a relational database?
a) A key that is always unique
b) A key that is automatically generated
c) A key that consists of two or more columns to uniquely identify a row
d) A key that links two tables - What does the SQL EXISTS keyword do?
a) Tests for the existence of a table
b) Tests for the existence of any record in a subquery
c) Deletes existing records
d) Returns the first record in a result set - Which SQL keyword is used to specify a condition in a query?
a) JOIN
b) ORDER BY
c) GROUP BY
d) WHERE - What is the purpose of the SQL INSERT INTO command?
a) To modify existing data
b) To delete data
c) To add new rows to a table
d) To create a new table - What is a database trigger?
a) A type of index
b) A procedure that automatically executes in response to certain events on a table
c) A query that retrieves data
d) A rule that enforces data integrity - What is the purpose of the SQL JOIN clause?
a) To remove duplicates
b) To filter rows
c) To combine rows from two or more tables based on a related column
d) To sort the result set - What is a candidate key?
a) A key that is used for foreign key relationships
b) A key that is always unique
c) A key that could be chosen as a primary key
d) A key that contains null values
Database Management System MCQs Set-16
- Which SQL function is used to return the current date?
a) SYSDATE()
b) GETDATE()
c) CURDATE()
d) NOW() - What is the function of the SQL LEFT JOIN?
a) Returns all records from the right table and matched records from the left table
b) Returns all records from the left table and matched records from the right table
c) Returns only the matched records from both tables
d) Returns records where the specified columns match in both tables - Which SQL command is used to modify existing data in a table?
a) DELETE
b) UPDATE
c) INSERT
d) ALTER - What is the purpose of the SQL ALTER TABLE command?
a) To delete rows from a table
b) To create a new table
c) To modify the structure of an existing table
d) To retrieve data from a table - Which SQL keyword is used to filter data based on a condition?
a) ORDER BY
b) GROUP BY
c) WHERE d) JOIN - What does the SQL function UPPER() do?
a) Converts all characters in a string to lowercase
b) Converts all characters in a string to uppercase
c) Finds the minimum value in a column
d) Finds the maximum value in a column - What is the purpose of the SQL COUNT() function?
a) To find the maximum value in a column
b) To find the minimum value in a column
c) To return the number of rows that match a specified condition
d) To calculate the average value of a column - What does the SQL UNION operator do?
a) Combines the results of two or more SELECT queries and removes duplicates
b) Combines the results of two or more SELECT queries including duplicates
c) Finds the intersection of two queries
d) Finds the difference between two queries - Which SQL command is used to remove all rows from a table, including its structure?
a) DELETE
b) TRUNCATE
c) DROP
d) REMOVE - What is a database constraint?
a) A rule applied to table columns to enforce data integrity
b) A type of index
c) A command to filter rows
d) A type of view - Which SQL keyword is used to specify the number of rows returned by a query?
a) GROUP BY
b) LIMIT
c) ORDER BY
d) TOP - What does the SQL function DATEPART() do?
a) Returns the current date
b) Extracts a specific part (like year, month, day) from a date
c) Converts a string to a date
d) Returns the number of days between two dates - What is a subquery in SQL?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What is the purpose of the SQL ORDER BY clause?
a) To group rows
b) To filter rows
c) To sort the result set by one or more columns
d) To aggregate data - What does the SQL function COALESCE() do?
a) Returns the first non-null value in a list of expressions
b) Finds the maximum value
c) Finds the minimum value
d) Counts the number of non-null values
Database Management System MCQs Set-17
- What is the purpose of the SQL REPLACE() function?
a) To replace occurrences of a substring within a string
b) To find the position of a substring
c) To remove whitespace from a string
d) To concatenate two strings - Which SQL command is used to remove a table from the database?
a) DROP TABLE
b) DELETE
c) TRUNCATE
d) ALTER TABLE - What does the SQL command CREATE INDEX do?
a) Creates an index to improve query performance
b) Deletes an existing index
c) Modifies the structure of a table
d) Adds a new column to a table - What is a SQL constraint used for?
a) To improve query performance
b) To create indexes
c) To enforce rules on the data in a database
d) To store large objects - What does the SQL SUBSTRING() function do?
a) Extracts a part of a string
b) Replaces a part of a string
c) Concatenates two strings
d) Converts a string to lowercase - Which SQL clause is used to group rows that have the same values in specified columns?
a) ORDER BY
b) GROUP BY
c) WHERE
d) HAVING - What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - Which SQL function is used to convert a string to an integer?
a) CONVERT()
b) CAST()
c) TO_NUMBER()
d) TO_INT() - What does the SQL function CHAR_LENGTH() do?
a) Returns the length of a string
b) Converts a string to uppercase
c) Finds the position of a substring
d) Replaces occurrences of a substring - Which SQL statement is used to create a new view?
a) CREATE TABLE
b) INSERT INTO
c) CREATE VIEW
d) CREATE INDEX - What does the SQL function CONCAT() do?
a) Finds the length of a string
b) Concatenates two or more strings
c) Converts a string to uppercase
d) Extracts a part of a string - Which SQL command is used to remove a specific constraint from a table?
a) ALTER TABLE
b) CREATE TABLE
c) DROP CONSTRAINT
d) MODIFY TABLE - What is a SQL cursor?
a) A command to retrieve data
b) A type of index
c) A database object used to retrieve rows from a result set one at a time
d) A function to aggregate data - What is the purpose of the SQL BETWEEN operator?
a) To filter records within a range of values
b) To join tables
c) To remove duplicates
d) To sort data - What does the SQL function REPLACE() do?
a) Removes whitespace from a string
b) Replaces occurrences of a substring with another substring
c) Finds the position of a substring
d) Converts a string to uppercase
Database Management System MCQs Set-18
- What is the purpose of the SQL TRUNCATE command?
a) Deletes specific rows from a table
b) Removes all rows from a table but keeps the table structure
c) Removes the table structure
d) Modifies the structure of the table - What does the SQL function ABS() do?
a) Returns the absolute value of a number
b) Rounds a number to the nearest integer
c) Calculates the sum of a numeric column
d) Returns the highest value in a column - Which SQL keyword is used to retrieve a specific number of rows from a query?
a) TOP
b) LIMIT
c) OFFSET
d) RANK - What does the SQL function IFNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Finds the minimum value in a column
d) Counts the number of rows - What is an SQL procedure?
a) A set of SQL statements that can be executed as a single unit
b) A type of index
c) A command to retrieve data
d) A constraint - Which SQL command is used to create a new table?
a) CREATE TABLE
b) ALTER TABLE
c) DROP TABLE
d) INSERT INTO - What does the SQL function CURRENT_TIMESTAMP do?
a) Returns the current date and time
b) Returns the current date
c) Returns the current time
d) Returns the time of the last transaction - What is a SQL index used for?
a) To speed up the retrieval of rows from a table
b) To enforce data integrity
c) To create a new table
d) To modify the structure of a table - Which SQL statement is used to modify the data type of a column in an existing table?
a) INSERT INTO
b) CREATE TABLE
c) ALTER TABLE
d) DROP TABLE - What is the purpose of the SQL GROUP_CONCAT() function?
a) Concatenates values from multiple rows into a single string
b) Finds the maximum value in a column
c) Calculates the sum of a numeric column
d) Filters rows based on a condition - What does the SQL function YEAR() do?
a) Extracts the year from a date
b) Extracts the month from a date
c) Extracts the day from a date
d) Returns the number of years between two dates - Which SQL clause is used to filter records after aggregation?
a) ORDER BY
b) HAVING
c) WHERE
d) GROUP BY - What is a SQL sequence?
a) A type of index
b) An object that generates a sequence of unique numeric values
c) A command to retrieve data
d) A type of view - What is the SQL command to remove all indexes from a table?
a) DROP INDEX
b) DELETE INDEX
c) REMOVE INDEX
d) ALTER INDEX - Which SQL function is used to remove leading and trailing spaces from a string?
a) TRIM()
b) LENGTH()
c) SUBSTRING()
d) REPLACE()
Database Management System MCQs Set-19
- What does the SQL CAST() function do?
a) Converts an expression from one data type to another
b) Extracts a substring from a string
c) Rounds a number to a specified decimal place
d) Converts a string to uppercase - What is a SQL transaction?
a) A sequence of SQL statements executed as a single unit
b) A command to create a new table
c) A type of index
d) A method for filtering data - What does the SQL COMMIT command do?
a) Saves all changes made during the current transaction
b) Reverts changes made during the transaction
c) Deletes all records from a table
d) Creates a new table - What is the function of the SQL ROLLBACK command?
a) Saves all changes made during the transaction
b) Undoes changes made during the current transaction
c) Creates a new index
d) Deletes a table - What is a SQL aggregate function?
a) A function that operates on a single value
b) A function that performs a calculation on a set of values and returns a single value
c) A function that concatenates two strings
d) A function that converts data types - Which SQL function is used to calculate the average value of a numeric column?
a) MAX()
b) MIN()
c) AVG()
d) SUM() - What does the SQL function DATEADD() do?
a) Adds a specified time interval to a date
b) Subtracts a specified time interval from a date
c) Extracts the year from a date
d) Calculates the difference between two dates - What is the purpose of the SQL SET command?
a) To create a new table
b) To assign a value to a variable or to update column values in a query
c) To remove a table
d) To delete specific rows from a table - What does the SQL function IF() do?
a) Evaluates a condition and returns one value if true and another if false
b) Calculates the sum of a numeric column
c) Extracts a substring from a string
d) Converts a string to a date - What is the purpose of the SQL JOIN ON clause?
a) To filter rows based on conditions
b) To specify the condition for joining two tables
c) To sort the results of a query
d) To create an index - Which SQL function returns the number of characters in a string?
a) CHAR_LENGTH()
b) LENGTH()
c) SUBSTRING()
d) TRIM() - What does the SQL function COALESCE() do?
a) Returns the number of non-null values in a column
b) Finds the maximum value in a column
c) Returns the first non-null expression among its arguments
d) Replaces null values with zeros - What is a SQL trigger?
a) A type of index
b) A constraint
c) A set of SQL statements automatically executed in response to certain events
d) A command to update data - What does the SQL function MONTH() do?
a) Extracts the month from a date
b) Extracts the day from a date
c) Returns the number of months between two dates
d) Converts a date to a string - Which SQL command is used to remove all data and structure from a table?
a) DELETE
b) DROP TABLE
c) TRUNCATE TABLE
d) REMOVE TABLE
Database Management System MCQs Set-20
- What does the SQL function DATEDIFF() do?
a) Calculates the difference between two dates
b) Adds a specified time interval to a date
c) Extracts the year from a date
d) Returns the current date and time - What is a SQL view?
a) A virtual table based on the result of a SELECT query
b) A physical table in the database
c) A type of index
d) A command to update data - What is the purpose of the SQL HAVING clause?
a) To filter rows before aggregation
b) To sort the results of a query
c) To filter results after aggregation
d) To join tables - What does the SQL function CONCAT_WS() do?
a) Concatenates strings with a specified separator
b) Finds the length of a string
c) Extracts a substring from a string
d) Converts a string to lowercase - Which SQL function returns the current time?
a) CURRENT_DATE()
b) NOW()
c) SYSDATE()
d) CURRENT_TIME() - What is the purpose of the SQL CREATE VIEW command?
a) To create a new table
b) To create an index
c) To create a virtual table based on a SELECT query
d) To modify the structure of an existing table - What does the SQL function YEAR() do?
a) Extracts the month from a date
b) Extracts the year from a date
c) Returns the current year
d) Calculates the number of years between two dates - What does the SQL DISTINCT keyword do?
a) Removes duplicate rows from the result set
b) Orders rows in a result set
c) Filters rows based on a condition
d) Groups rows with the same values - What is a SQL index used for?
a) To enforce data integrity
b) To improve query performance
c) To create a new table
d) To speed up the retrieval of rows from a table - What is the function of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What does the SQL function SUBSTRING() do?
a) Replaces a part of a string
b) Extracts a substring from a string
c) Converts a string to uppercase
d) Finds the length of a string - What is a SQL constraint?
a) A command to retrieve data
b) A rule applied to table columns to enforce data integrity
c) A type of index
d) A method to filter rows - What does the SQL function DATEPART() do?
a) Converts a date to a string
b) Returns the current date
c) Extracts a specific part of a date, such as year, month, or day
d) Calculates the difference between two dates - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What does the SQL function GROUP_CONCAT() do?
a) Finds the maximum value in a column
b) Calculates the sum of a numeric column
c) Concatenates values from multiple rows into a single string
d) Filters rows based on a condition
Database Management System MCQs Set-21
- What is the purpose of the SQL GROUP BY clause?
a) To group rows that have the same values in specified columns
b) To sort the result set
c) To filter rows
d) To join tables - What is a SQL transaction?
a) A command to create a new table
b) A type of index
c) A sequence of SQL statements executed as a single unit
d) A method for filtering data - What does the SQL function ROUND() do?
a) Returns the maximum value in a column
b) Rounds a numeric field to a specified number of decimal places
c) Counts the number of rows
d) Finds the minimum value in a column - What does the SQL function IFNULL() do?
a) Finds the maximum value in a column
b) Replaces NULL values with a specified value
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the purpose of the SQL SET command?
a) To create a new table
b) To assign a value to a variable or update column values in a query
c) To remove a table
d) To delete specific rows from a table - What does the SQL function DATEDIFF() do?
a) Adds a specified time interval to a date
b) Extracts the year from a date
c) Calculates the difference between two dates
d) Returns the number of days between two dates - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What is the purpose of the SQL REPLACE() function?
a) To find the position of a substring
b) To replace occurrences of a substring within a string
c) To concatenate two strings
d) To remove whitespace from a string - What does the SQL function CHAR_LENGTH() do?
a) Returns the length of a string
b) Finds the position of a substring
c) Converts a string to uppercase
d) Replaces occurrences of a substring - What does the SQL function COALESCE() do?
a) Finds the maximum value in a column
b) Returns the first non-null value in a list of expressions
c) Counts the number of non-null values
d) Replaces null values with zeros - What is a SQL cursor?
a) A command to retrieve data
b) A type of index
c) A database object used to retrieve rows from a result set one at a time
d) A function to aggregate data - What is the function of the SQL UNION operator?
a) Finds the intersection of two queries
b) Combines the results of two or more SELECT queries and removes duplicates
c) Finds the difference between two queries
d) Joins two tables - What does the SQL function YEAR() do?
a) Extracts the month from a date
b) Extracts the year from a date
c) Returns the current year
d) Calculates the number of years between two dates - What is the SQL command to remove all data and structure from a table?
a) DELETE
b) DROP TABLE
c) TRUNCATE TABLE
d) REMOVE TABLE - What does the SQL function GROUP_CONCAT() do?
a) Finds the maximum value in a column
b) Calculates the sum of a numeric column
c) Concatenates values from multiple rows into a single string
d) Filters rows based on a condition
Database Management System MCQs Set-22
- What is the purpose of the SQL JOIN clause?
a) To combine rows from two or more tables based on a related column
b) To sort the result set
c) To filter rows
d) To create a new table - What does the SQL function CURRENT_DATE() return?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction - What is a SQL sequence used for?
a) To filter rows
b) To join tables
c) To generate a sequence of unique numeric values
d) To concatenate strings - What does the SQL function REPLACE() do?
a) Replaces occurrences of a substring with another substring
b) Removes whitespace from a string
c) Finds the position of a substring
d) Converts a string to uppercase - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What does the SQL function IFNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the purpose of the SQL GROUP BY clause?
a) To filter rows based on conditions
b) To group rows with the same values in specified columns
c) To sort the results of a query
d) To join tables - What does the SQL function LENGTH() do?
a) Extracts a substring from a string
b) Returns the number of characters in a string
c) Converts a string to lowercase
d) Finds the position of a substring - What does the SQL function DATEPART() do?
a) Converts a date to a string
b) Extracts a specific part of a date, such as year, month, or day
c) Calculates the difference between two dates
d) Returns the number of days between two dates - What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - What does the SQL function MONTH() do?
a) Extracts the month from a date
b) Extracts the day from a date
c) Returns the number of months between two dates
d) Converts a date to a string - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What is a SQL constraint used for?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store large objects - What is the SQL command to remove a specific constraint from a table?
a) ALTER TABLE
b) CREATE TABLE
c) DROP CONSTRAINT
d) MODIFY TABLE
Database Management System MCQs Set-23
- What is the function of the SQL DISTINCT keyword?
a) Removes duplicate rows from the result set
b) Orders rows in a result set
c) Filters rows based on a condition
d) Groups rows with the same values - What does the SQL function NOW() return?
a) The current date
b) The current date and time
c) The current time
d) The time of the last transaction - What is the purpose of the SQL UPDATE command?
a) To create a new table
b) To remove all rows from a table
c) To modify existing records in a table
d) To retrieve data from a table - What does the SQL function SUBSTRING() do?
a) Replaces a part of a string
b) Extracts a substring from a string
c) Converts a string to uppercase
d) Finds the length of a string - What is the purpose of the SQL DROP TABLE command?
a) To remove specific rows from a table
b) To remove all rows from a table
c) To remove the entire table and its structure from the database
d) To modify the structure of the table - What is a SQL procedure?
a) A type of index
b) A command to retrieve data
c) A set of SQL statements that can be executed as a single unit
d) A constraint - What does the SQL function CHAR_LENGTH() do?
a) Returns the length of a string
b) Finds the position of a substring
c) Converts a string to uppercase
d) Replaces occurrences of a substring - What is the purpose of the SQL HAVING clause?
a) To filter rows before aggregation
b) To filter records after aggregation
c) To sort the results of a query
d) To join tables - What is a SQL index used for?
a) To enforce data integrity
b) To speed up the retrieval of rows from a table
c) To create a new table
d) To modify the structure of a table - What does the SQL function COALESCE() do?
a) Returns the first non-null value in a list of expressions
b) Finds the maximum value in a column
c) Counts the number of non-null values
d) Replaces null values with zeros - What is the SQL command to create a new table?
a) CREATE TABLE
b) ALTER TABLE
c) DROP TABLE
d) INSERT INTO - What does the SQL function YEAR() do?
a) Extracts the month from a date
b) Extracts the year from a date
c) Returns the current year
d) Calculates the number of years between two dates - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What is the purpose of the SQL REPLACE() function?
a) To find the position of a substring
b) To replace occurrences of a substring within a string
c) To concatenate two strings
d) To remove whitespace from a string - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table
Database Management System MCQs Set-24
- What is the purpose of the SQL JOIN clause?
a) To combine rows from two or more tables based on a related column
b) To sort the result set
c) To filter rows
d) To create a new table - What does the SQL function CURRENT_DATE() return?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction - What is a SQL sequence used for?
a) To filter rows
b) To join tables
c) To generate a sequence of unique numeric values
d) To concatenate strings - What does the SQL function REPLACE() do?
a) Replaces occurrences of a substring with another substring
b) Removes whitespace from a string
c) Finds the position of a substring
d) Converts a string to uppercase - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What does the SQL function IFNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the purpose of the SQL GROUP BY clause?
a) To filter rows based on conditions
b) To group rows with the same values in specified columns
c) To sort the results of a query
d) To join tables - What does the SQL function LENGTH() do?
a) Extracts a substring from a string
b) Returns the number of characters in a string
c) Converts a string to lowercase
d) Finds the position of a substring - What does the SQL function DATEPART() do?
a) Converts a date to a string
b) Extracts a specific part of a date, such as year, month, or day
c) Calculates the difference between two dates
d) Returns the number of days between two dates - What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - What does the SQL function MONTH() do?
a) Extracts the month from a date
b) Extracts the day from a date
c) Returns the number of months between two dates
d) Converts a date to a string - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What is a SQL constraint used for?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store large objects - What is the SQL command to remove a specific constraint from a table?
a) ALTER TABLE
b) CREATE TABLE
c) DROP CONSTRAINT
d) MODIFY TABLE
Database Management System MCQs Set-25
- What is the purpose of the SQL JOIN clause?
a) To combine rows from two or more tables based on a related column
b) To sort the result set
c) To filter rows
d) To create a new table - What does the SQL function CURRENT_DATE() return?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction - What is a SQL sequence used for?
a) To filter rows
b) To join tables
c) To generate a sequence of unique numeric values
d) To concatenate strings - What does the SQL function REPLACE() do?
a) Replaces occurrences of a substring with another substring
b) Removes whitespace from a string
c) Finds the position of a substring
d) Converts a string to uppercase - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What does the SQL function IFNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the purpose of the SQL GROUP BY clause?
a) To filter rows based on conditions
b) To group rows with the same values in specified columns
c) To sort the results of a query
d) To join tables - What does the SQL function LENGTH() do?
a) Extracts a substring from a string
b) Returns the number of characters in a string
c) Converts a string to lowercase
d) Finds the position of a substring - What does the SQL function DATEPART() do?
a) Converts a date to a string
b) Extracts a specific part of a date, such as year, month, or day
c) Calculates the difference between two dates
d) Returns the number of days between two dates - What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - What does the SQL function MONTH() do?
a) Extracts the month from a date
b) Extracts the day from a date
c) Returns the number of months between two dates
d) Converts a date to a string - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What is a SQL constraint used for?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store large objects - What is the SQL command to remove a specific constraint from a table?
a) ALTER TABLE
b) CREATE TABLE
c) DROP CONSTRAINT
d) MODIFY TABLE
Database Management System MCQs Set-26
- What is the purpose of the SQL JOIN clause?
a) To combine rows from two or more tables based on a related column
b) To sort the result set
c) To filter rows
d) To create a new table - What does the SQL function CURRENT_DATE() return?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction - What is a SQL sequence used for?
a) To filter rows
b) To join tables
c) To generate a sequence of unique numeric values
d) To concatenate strings - What does the SQL function REPLACE() do?
a) Replaces occurrences of a substring with another substring
b) Removes whitespace from a string
c) Finds the position of a substring
d) Converts a string to uppercase - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What does the SQL function IFNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the purpose of the SQL GROUP BY clause?
a) To filter rows based on conditions
b) To group rows with the same values in specified columns
c) To sort the results of a query
d) To join tables - What does the SQL function LENGTH() do?
a) Extracts a substring from a string
b) Returns the number of characters in a string
c) Converts a string to lowercase
d) Finds the position of a substring - What does the SQL function DATEPART() do?
a) Converts a date to a string
b) **Extracts a specific part of a date
, such as year, month, or day**
c) Calculates the difference between two dates
d) Returns the number of days between two dates
- What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - What does the SQL function MONTH() do?
a) Extracts the month from a date
b) Extracts the day from a date
c) Returns the number of months between two dates
d) Converts a date to a string - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What is a SQL constraint used for?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store large objects - What is the SQL command to remove a specific constraint from a table?
a) ALTER TABLE
b) CREATE TABLE
c) DROP CONSTRAINT
d) MODIFY TABLE
Database Management System MCQs Set-27
- What is the purpose of the SQL JOIN clause?
a) To combine rows from two or more tables based on a related column
b) To sort the result set
c) To filter rows
d) To create a new table - What does the SQL function CURRENT_DATE() return?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction - What is a SQL sequence used for?
a) To filter rows
b) To join tables
c) To generate a sequence of unique numeric values
d) To concatenate strings - What does the SQL function REPLACE() do?
a) Replaces occurrences of a substring with another substring
b) Removes whitespace from a string
c) Finds the position of a substring
d) Converts a string to uppercase - What is a SQL subquery?
a) A type of index
b) A query that updates data
c) A query nested inside another query
d) A query that creates a new table - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What does the SQL function IFNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the purpose of the SQL GROUP BY clause?
a) To filter rows based on conditions
b) To group rows with the same values in specified columns
c) To sort the results of a query
d) To join tables - What does the SQL function LENGTH() do?
a) Extracts a substring from a string
b) Returns the number of characters in a string
c) Converts a string to lowercase
d) Finds the position of a substring - What does the SQL function DATEPART() do?
a) Converts a date to a string
b) Extracts a specific part of a date, such as year, month, or day
c) Calculates the difference between two dates
d) Returns the number of days between two dates - What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - What does the SQL function MONTH() do?
a) Extracts the month from a date
b) Extracts the day from a date
c) Returns the number of months between two dates
d) Converts a date to a string - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What is a SQL constraint used for?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store large objects - What is the SQL command to remove a specific constraint from a table?
a) ALTER TABLE
b) CREATE TABLE
c) DROP CONSTRAINT
d) MODIFY TABLE
Database Management System MCQs Set-28
- What is the purpose of the SQL INNER JOIN clause?
a) To return rows when there is a match in both tables
b) To return rows where there is no match
c) To combine all rows from both tables
d) To return rows from only one table - What does the SQL function GETDATE() return?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction - What is the purpose of the SQL UNION ALL operator?
a) To combine the results of two or more SELECT queries and include duplicates
b) To combine results and remove duplicates
c) To find the intersection of two queries
d) To create a new table - What does the SQL function TRIM() do?
a) Removes leading and trailing spaces from a string
b) Converts a string to uppercase
c) Finds the position of a substring
d) Replaces occurrences of a substring - What is a SQL cursor used for?
a) To create new tables
b) To retrieve and manipulate individual rows from a result set
c) To perform bulk operations
d) To aggregate data - What is the SQL command to add a new column to an existing table?
a) ALTER TABLE
b) MODIFY TABLE
c) ALTER TABLE ADD COLUMN
d) UPDATE TABLE - What does the SQL function CONCAT() do?
a) Combines two or more strings into one string
b) Finds the position of a substring
c) Converts a string to lowercase
d) Replaces occurrences of a substring - What is the purpose of the SQL WHERE clause?
a) To sort the result set
b) To filter records based on a specified condition
c) To group rows with similar values
d) To join tables - What does the SQL function DATEADD() do?
a) Converts a date to a string
b) Adds a specified time interval to a date
c) Extracts a specific part of a date
d) Finds the difference between two dates - What is the SQL command to update records in a table?
a) INSERT INTO
b) DELETE
c) UPDATE
d) ALTER TABLE - What is the purpose of the SQL DISTINCT keyword?
a) Removes duplicate rows from the result set
b) Orders rows in a result set
c) Filters rows based on a condition
d) Groups rows with the same values - What is the SQL command to delete a table structure but not its data?
a) DROP TABLE
b) TRUNCATE TABLE
c) DELETE
d) REMOVE TABLE - What does the SQL function SUBSTR() do?
a) Extracts a substring from a string
b) Replaces part of a string
c) Finds the length of a string
d) Converts a string to uppercase - What is the purpose of the SQL HAVING clause?
a) To filter rows before aggregation
b) To filter records after aggregation
c) To sort the results of a query
d) To join tables - What does the SQL function ROUND() do?
a) Rounds a numeric field to the specified number of decimal places
b) Calculates the average of a numeric field
c) Finds the maximum value in a numeric field
d) Converts a number to a string
Database Management System MCQs Set-29
- What is the purpose of the SQL LEFT JOIN clause?
a) To return rows from the right table only
b) To return all rows from the left table and the matched rows from the right table
c) To return rows from both tables where they match
d) To return rows where there is no match - What does the SQL function DATEPART() do?
a) Extracts a specific part of a date, such as year, month, or day
b) Calculates the difference between two dates
c) Converts a date to a string
d) Returns the number of days between two dates - What is the purpose of the SQL GROUP_CONCAT() function?
a) Concatenates values from multiple rows into a single string
b) Finds the maximum value in a column
c) Calculates the sum of a numeric column
d) Filters rows based on a condition - What does the SQL function STRFTIME() do?
a) Converts a string to a date
b) Formats a date according to a specified format string
c) Extracts a part of a date
d) Adds a time interval to a date - What is the SQL command to create a new table?
a) CREATE TABLE
b) INSERT INTO
c) UPDATE
d) ALTER TABLE - What is the purpose of the SQL PRIMARY KEY constraint?
a) To uniquely identify each record in a table
b) To allow duplicate values
c) To ensure data integrity
d) To create relationships between tables - What does the SQL function ISNULL() do?
a) Replaces NULL values with a specified value
b) Finds the maximum value in a column
c) Calculates the average value of a column
d) Converts a string to uppercase - What is the SQL command to rename a table?
a) ALTER TABLE
b) RENAME TABLE
c) RENAME TABLE
d) MODIFY TABLE - What is the purpose of the SQL LIMIT clause?
a) To specify a condition in a query
b) To restrict the number of rows returned by a query
c) To sort the results of a query
d) To aggregate data - What does the SQL function REPLACE() do?
a) Replaces occurrences of a substring with another substring
b) Removes whitespace from a string
c) Finds the position of a substring
d) Converts a string to uppercase - What is a SQL view?
a) A physical table
b) A virtual table based on the result of a SELECT query
c) An index
d) A type of constraint - What does the SQL function MAX() do?
a) Finds the minimum value in a column
b) Finds the maximum value in a column
c) Calculates the sum of a numeric column
d) Counts the number of rows - What is the SQL command to delete all records from a table?
a) DROP TABLE
b) DELETE
c) REMOVE TABLE
d) TRUNCATE TABLE - What is the purpose of the SQL ALTER TABLE command?
a) To delete records from a table
b) To create a new table
c) To modify the structure of an existing table
d) To retrieve data from a table - What does the SQL function NOW() do?
a) The current date
b) The current time
c) The current date and time
d) The time of the last transaction
Database Management System MCQs Set-30
- What is the SQL command to remove a table from the database?
a) DROP TABLE
b) DELETE
c) REMOVE TABLE
d) TRUNCATE TABLE - What does the SQL function LENGTH() do?
a) Extracts a substring from a string
b) Converts a string to uppercase
c) Returns the number of characters in a string
d) Finds the position of a substring - What is the SQL command to create a new index?
a) CREATE TABLE
b) CREATE VIEW
c) CREATE INDEX
d) ALTER TABLE - What does the SQL function DATEADD() do?
a) Converts a date to a string
b) Adds a specified time interval to a date
c) Extracts a specific part of a date
d) Find the difference between the two dates - What is the purpose of the SQL LIKE operator?
a) To search for a specified pattern in a column
b) To join two tables
c) To filter rows based on exact matches
d) To sort the results of a query - What does the SQL function MIN() do?
a) Finds the maximum value in a column
b) Finds the minimum value in a column
c) Calculates the average of a column
d) Counts the number of rows - What is the SQL command to create a new table?
a) CREATE TABLE
b) INSERT INTO
c) UPDATE
d) ALTER TABLE - What is an SQL constraint used for?
a) To improve query performance
b) To enforce rules on the data in a database
c) To create indexes
d) To store large objects - What does the SQL function COALESCE() do?
a) Finds the maximum value in a column
b) Counts the number of non-null values
c) Returns the first non-null value from a list of arguments - What is the SQL command to modify a column in an existing table?
a) INSERT INTO
b) DELETE
c) ALTER TABLE MODIFY COLUMN
d) CREATE TABLE - What is an SQL sequence used for?
a) To filter rows
b) To join tables
c) To generate a sequence of unique numeric values
d) To concatenate strings - What does the SQL function UPPER() do?
a) Converts a string to uppercase
b) Replaces occurrences of a substring
c) Finds the position of a substring
d) Extracts a substring - What is the SQL command to add a constraint to a table?
a) ALTER TABLE
b) CREATE TABLE
c) ALTER TABLE ADD CONSTRAINT
d) MODIFY TABLE - What does the SQL function AVG() do?
a) Finds the minimum value in a column
b) Calculates the average value of a column
c) Counts the number of rows
d) Finds the maximum value in a column - What is the purpose of the SQL ORDER BY clause?
a) To sort the result set by one or more columns
b) To filter rows based on a condition
c) To group rows with the same values
d) To join tables