MySQL
MySQL is an open-source relational database management system (RDBMS) that uses Structured Query Language (SQL) for managing and manipulating databases. It is widely used for storing and retrieving data in various applications.
MySQL is freely available and is open source
a) True ✅
b) False
c) Not sure
d) PrivateWhat represents a ‘tuple’ in a relational database?
a) Table
b) Row ✅
c) Column
d) ObjectHow is communication established with MySQL?
a) SQL ✅
b) Network calls
c) A programming language like C++
d) APIsThe MySQL server used in its client/server architecture is _______________
a) mysqla
b) mysqlb
c) mysqlc
d) mysqld ✅Which of the following clauses is used to display information that matches a given pattern?
a) LIKE ✅
b) WHERE
c) IS
d) SAMEWhat command is used to delete all records from a table without deleting the table itself?
a) TRUNCATE ✅
b) DROP
c) DELETE
d) REMOVEWhich of the following SQL statements is used to fetch data from a database?
a) SELECT ✅
b) FETCH
c) GET
d) RETRIEVEWhich SQL clause is used to sort the result set?
a) ORDER BY ✅
b) SORT
c) GROUP BY
d) ARRANGEWhich of the following is used to create a new database in MySQL?
a) CREATE DATABASE ✅
b) NEW DATABASE
c) MAKE DATABASE
d) ADD DATABASEWhich of the following is the correct way to use the SELECT statement to retrieve data from the “students” table where the student’s name is “John”?
a) SELECT * FROM students WHERE name = ‘John’;
b) SELECT * FROM students WHERE name = ‘John’ ✅
c) SELECT name FROM students WHERE name = ‘John’;
d) SELECT students WHERE name = ‘John’;Which of the following statements is true about indexes in MySQL?
a) Indexes are automatically created by MySQL.
b) Indexes help improve the performance of queries.
c) Indexes reduce the space used by the database.
d) Indexes help improve the performance of queries. ✅Which of the following is used to retrieve a specific range of rows in MySQL?
a) LIMIT ✅
b) RANGE
c) FETCH
d) RESTRICTWhat does the SELECT DISTINCT statement do in SQL?
a) Retrieves only one record from the database.
b) Retrieves only unique records. ✅
c) Sorts the records in ascending order.
d) Limits the number of records returned.Which of the following MySQL data types is used to store a variable-length string?
a) VARCHAR ✅
b) TEXT
c) CHAR
d) BLOBWhich SQL command is used to modify the existing data in a table?
a) UPDATE ✅
b) MODIFY
c) CHANGE
d) ALTERWhich of the following is true about the SQL INSERT INTO statement?
a) It is used to retrieve records from a table.
b) It is used to delete records from a table.
c) It is used to add new records to a table. ✅
d) It is used to modify existing records in a table.Which of the following SQL clauses is used to combine rows from two or more tables based on a related column?
a) UNION
b) JOIN ✅
c) COMBINE
d) MERGEWhat is the purpose of the WHERE clause in SQL?
a) To sort the records
b) To filter the records based on a condition. ✅
c) To group the records
d) To order the recordsWhat command is used to modify the structure of an existing database table?
a) ALTER TABLE ✅
b) MODIFY TABLE
c) CHANGE TABLE
d) UPDATE TABLEWhat does the SQL SELECT statement return?
a) The entire database
b) A table
c) A result set based on the query. ✅
d) A single record
Which SQL keyword is used to retrieve records from multiple tables?
a) JOIN ✅
b) COMBINE
c) UNION
d) MERGEWhich of the following is the correct way to add a primary key to an existing table in MySQL?
a) ALTER TABLE table_name ADD PRIMARY KEY (column_name);
b) ALTER TABLE table_name ADD PRIMARY KEY (column_name); ✅
c) MODIFY TABLE table_name ADD PRIMARY KEY (column_name);
d) CHANGE TABLE table_name ADD PRIMARY KEY (column_name);Which function is used to count the number of rows in a table?
a) COUNT() ✅
b) SUM()
c) AVG()
d) ROWS()Which SQL clause is used to remove duplicate rows from the result set?
a) DISTINCT ✅
b) UNIQUE
c) DIFFERENT
d) NO_DUPLICATESWhich of the following operators is used to search for a specified pattern in a column?
a) LIKE ✅
b) IN
c) BETWEEN
d) EQUALSWhich of the following statements is used to delete a table from a database in MySQL?
a) DROP TABLE ✅
b) DELETE TABLE
c) REMOVE TABLE
d) CLEAR TABLEWhich keyword is used to sort the result set in descending order in SQL?
a) DESC ✅
b) SORT DESC
c) ORDER DESC
d) REVERSEWhich of the following SQL functions is used to return the maximum value in a column?
a) MIN()
b) MAX() ✅
c) AVG()
d) SUM()Which of the following commands is used to create an index on a table in MySQL?
a) CREATE INDEX ✅
b) ADD INDEX
c) NEW INDEX
d) MAKE INDEXWhich SQL clause is used to group rows that have the same values in specified columns?
a) GROUP BY ✅
b) ORDER BY
c) SORT BY
d) AGGREGATEWhich of the following statements is used to update data in a table?
a) UPDATE ✅
b) MODIFY
c) CHANGE
d) ALTERWhich operator is used to test for NULL values in SQL?
a) IS NULL ✅
b) NULL TEST
c) IS EMPTY
d) NULL CHECKWhich of the following is used to display the current date and time in MySQL?
a) NOW() ✅
b) GETDATE()
c) CURDATE()
d) CURRENT_DATE()Which SQL statement is used to add a new row to a table?
a) INSERT INTO ✅
b) ADD INTO
c) INSERT VALUES
d) NEW RECORDWhich of the following is used to set a condition to limit the rows returned in a SQL query?
a) WHERE ✅
b) HAVING
c) IF
d) LIMITWhich of the following is used to remove a column from an existing table?
a) ALTER TABLE table_name DROP COLUMN column_name; ✅
b) DELETE COLUMN column_name;
c) REMOVE COLUMN column_name;
d) DROP COLUMN column_name FROM table_name;Which function is used to get the length of a string in SQL?
a) LENGTH() ✅
b) STRLEN()
c) CHAR_LENGTH()
d) SIZE()Which keyword is used to retrieve data from two or more tables in SQL?
a) JOIN ✅
b) UNION
c) COMBINE
d) INTERSECTWhich SQL clause is used to specify the sorting order of records?
a) ORDER BY ✅
b) SORT BY
c) GROUP BY
d) ARRANGE BYWhich of the following is the correct way to select only unique values in a column?
a) SELECT DISTINCT column_name FROM table_name;
b) SELECT UNIQUE column_name FROM table_name;
c) SELECT DISTINCT column_name FROM table_name; ✅
d) SELECT DISTINCT FROM table_name column_name;
Which SQL keyword is used to sort the result set in ascending order?
a) ASC ✅
b) DESC
c) SORT
d) ORDERWhat does the SQL statement
SELECT COUNT(*) FROM table_name;
do?
a) It selects all columns from the table.
b) It counts the number of rows in the table. ✅
c) It counts the distinct rows in the table.
d) It counts the total number of columns in the table.Which SQL clause is used to filter records after grouping them?
a) HAVING ✅
b) WHERE
c) GROUP
d) FILTERWhich of the following is used to combine the results of two SELECT statements in SQL?
a) UNION ✅
b) JOIN
c) INTERSECT
d) COMBINEWhich keyword is used to limit the number of rows returned in a SQL query?
a) LIMIT
b) TOP ✅
c) ROWS
d) RESTRICTWhich of the following SQL statements is used to remove a row from a table?
a) DELETE ✅
b) DROP
c) REMOVE
d) TRUNCATEWhich SQL clause is used to specify the column in which you want to perform an aggregate function?
a) GROUP BY ✅
b) ORDER BY
c) HAVING
d) SELECTWhich SQL statement is used to change an existing column in a table?
a) ALTER TABLE ✅
b) MODIFY COLUMN
c) CHANGE COLUMN
d) UPDATE COLUMNWhich SQL function is used to return the current date in MySQL?
a) CURDATE() ✅
b) NOW()
c) GETDATE()
d) CURRENT_DATE()Which clause is used to retrieve data from multiple tables based on a relationship between them?
a) JOIN ✅
b) UNION
c) INTERSECT
d) MERGEWhich SQL keyword is used to find records that match a specific pattern?
a) MATCH
b) LIKE ✅
c) CONTAINS
d) EQUALSWhich statement is used to modify data in a table?
a) UPDATE ✅
b) MODIFY
c) CHANGE
d) ALTERWhich SQL keyword is used to return only distinct (unique) values in a query?
a) DISTINCT ✅
b) UNIQUE
c) NO_DUPLICATES
d) DIFFERENTWhich of the following SQL functions is used to find the average value of a column?
a) SUM()
b) AVG() ✅
c) COUNT()
d) MAX()Which SQL clause is used to define the condition for the rows to be included in a result set?
a) WHERE ✅
b) HAVING
c) GROUP BY
d) FILTERWhat does the
ORDER BY
clause do in SQL?
a) Sorts the result set in ascending or descending order. ✅
b) Limits the number of rows.
c) Groups the result set.
d) Filters the records based on a condition.Which function returns the number of characters in a string?
a) LENGTH() ✅
b) COUNT()
c) CHAR_LENGTH()
d) SIZE()Which SQL function is used to concatenate two or more strings in MySQL?
a) CONCAT() ✅
b) MERGE()
c) JOIN()
d) COMBINE()Which SQL command is used to remove all the rows from a table without deleting the table itself?
a) TRUNCATE TABLE ✅
b) DELETE
c) DROP TABLE
d) REMOVEWhich operator is used to find a range of values in a SQL query?
a) BETWEEN ✅
b) IN
c) LIKE
d) RANGE
Which SQL clause is used to group rows that have the same values into summary rows?
a) GROUP BY ✅
b) ORDER BY
c) HAVING
d) SELECTWhich of the following SQL statements is used to add a new row to a table?
a) INSERT INTO ✅
b) ADD ROW
c) UPDATE
d) ADD RECORDWhich SQL keyword is used to specify the column for sorting in descending order?
a) DESC ✅
b) ASC
c) ORDER
d) SORTWhich SQL statement is used to remove a table from a database?
a) DROP TABLE ✅
b) DELETE TABLE
c) REMOVE TABLE
d) TRUNCATE TABLEWhich of the following SQL commands is used to change the structure of an existing table?
a) ALTER TABLE ✅
b) MODIFY TABLE
c) CHANGE TABLE
d) UPDATE TABLEWhat is the default sort order used by the
ORDER BY
clause in SQL?
a) Ascending (ASC) ✅
b) Descending (DESC)
c) Random
d) NoneWhich function in SQL is used to return the highest value in a column?
a) MAX() ✅
b) MIN()
c) SUM()
d) AVG()Which operator is used in SQL to combine the results of two SELECT statements?
a) JOIN
b) UNION ✅
c) INTERSECT
d) COMBINEWhat does the
HAVING
clause do in SQL?
a) Filters records after grouping. ✅
b) Filters records before grouping.
c) Specifies the sort order of results.
d) Limits the number of rows returned.Which keyword is used in SQL to return the number of rows affected by a query?
a) ROWCOUNT ✅
b) COUNT
c) NUMROWS
d) TOTALWhich SQL function is used to find the minimum value in a column?
a) MIN() ✅
b) MAX()
c) AVG()
d) SUM()Which SQL clause is used to specify the pattern to search for in a string?
a) MATCH
b) LIKE ✅
c) CONTAINS
d) EQUALSWhich operator is used to filter the records where a column’s value is between two values in SQL?
a) IN
b) BETWEEN ✅
c) LIKE
d) MATCHWhich statement is used to combine data from two or more tables in SQL based on a related column?
a) JOIN ✅
b) UNION
c) INTERSECT
d) MERGEWhich SQL statement is used to retrieve the current system date and time?
a) NOW() ✅
b) CURRENT_TIMESTAMP
c) GETDATE()
d) SYS_DATE()Which SQL command is used to remove all rows from a table and reset the table to its empty state without removing the table itself?
a) TRUNCATE ✅
b) DELETE
c) REMOVE
d) RESETWhich SQL operator is used to test for NULL values?
a) IS NULL ✅
b) = NULL
c) IS EMPTY
d) NULL TESTWhich SQL function is used to find the total sum of a column’s values?
a) COUNT()
b) SUM() ✅
c) AVG()
d) MAX()Which clause is used to define conditions for rows to be included in a SQL query’s result set?
a) WHERE ✅
b) HAVING
c) FILTER
d) GROUP BYWhich SQL function is used to combine the result of two or more strings?
a) JOIN()
b) CONCAT() ✅
c) COMBINE()
d) UNION()