
1) Which of the following is an open-source relational database management system?
a) MongoDB
b) Oracle Database
c) MySQL
d) Amazon Aurora
Answer: c) MySQL
2) Which of the following statements is true about MySQL?
a) It is written in PHP
b) It uses NoSQL data model
c) It supports ACID properties
d) It only runs on Windows operating systems
Answer: c) It supports ACID properties
3) Which of the following is not a valid datatype in MySQL?
a) BOOLEAN
b) DOUBLE
c) CHAR
d) STRING
Answer: d) STRING
4) Which of the following is not a valid constraint in MySQL?
a) FOREIGN KEY
b) UNIQUE
c) PRIMARY KEY
d) MAXIMUM VALUE
Answer: d) MAXIMUM VALUE
5) What is the default port number for MySQL?
a) 80
b) 443
c) 3306
d) 5432
Answer: c) 3306
6) Which SQL statement is used to create a new table in MySQL?
a) ALTER TABLE
b) CREATE TABLE
c) UPDATE TABLE
d) DELETE TABLE
Answer: b) CREATE TABLE
7) Which MySQL command is used to create a backup of a database or table?
a) BACKUP DATABASE
b) CREATE BACKUP
c) mysqldump
d) EXPORT DATABASE
Answer: c) mysqldump
8) Which command is used in MySQL to add a new column to an existing table?
a) ALTER TABLE
b) CREATE TABLE
c) UPDATE TABLE
d) DELETE TABLE
Answer: a) ALTER TABLE
9) Which MySQL function is used to retrieve the current date and time?
a) NOW()
b) DATE()
c) TIME()
d) TIMESTAMP()
Answer: a) NOW()
10) Which of the following operators is used in MySQL to compare two values for equality?
a) =
b) ==
c) !=
d) <>
Answer: a) =
11) Which of the following is not a valid comparison operator in MySQL?
a) LIKE
b) IN
c) NOT IN
d) CONTAINS
Answer: d) CONTAINS
12) Which MySQL function is used to return the number of rows in a table?
a) COUNT(*)
b) MAX()
c) MIN()
d) AVG()
Answer: a) COUNT(*)
13) Which of the following is not a valid aggregate function in MySQL?
a) SUM()
b) COUNT()
c) AVERAGE()
d) MAX()
Answer: c) AVERAGE()
14) Which of the following is used in MySQL to specify a condition that must be met for the returned rows?
a) WHERE clause
b) ORDER BY clause
c) GROUP BY clause
d) HAVING clause
Answer: a) WHERE clause
15) Which MySQL command is used to delete a table?
a) REMOVE TABLE
b) DELETE TABLE
c) DROP TABLE
d) ERASE TABLE
Answer: c) DROP TABLE
16) Which of the following is not a valid join type in MySQL?
a) INNER JOIN
b) LEFT JOIN
c) OUTER JOIN
d) CROSS JOIN
Answer: c) OUTER JOIN
17) In a MySQL query, how do you limit the number of rows returned?
a) LIMIT
b) SELECT
c) WHERE
d) ORDER BY
Answer: a) LIMIT
18) Which MySQL command is used to grant privileges to a user?
a) GRANT PRIVILEGES
b) ADD PRIVILEGE
c) GRANT ALL
d) SET PRIVILEGES
Answer: c) GRANT ALL
19) Which of the following is not a valid MySQL storage engine?
a) MyISAM
b) InnoDB
c) XAMPP
d) Memory
Answer: c) XAMPP
20) Which MySQL command is used to change the password of a user?
a) ALTER USER
b) CHANGE PASSWORD
c) SET PASSWORD
d) UPDATE USER
Answer: c) SET PASSWORD
21) Which MySQL function is used to return the current user name?
a) USERNAME()
b) USER()
c) CURRENT_USER()
d) SESSION_USER()
Answer: c) CURRENT_USER()
22) Which of the following is a valid MySQL data type for storing date and time values?
a) DATETIME
b) DATEONLY
c) TIMEONLY
d) TIMESTAMP
Answer: a) DATETIME
23) Which MySQL command is used to create a new database?
a) CREATE DATABASE
b) ADD DATABASE
c) NEW DATABASE
d) INSERT DATABASE
Answer: a) CREATE DATABASE
24) Which MySQL function is used to return the year from a date or datetime value?
a) YEAR()
b) MONTH()
c) DAY()
d) WEEK()
Answer: a) YEAR()
25) In MySQL, which clause is used to sort the result set by a specific column?
a) ORDER BY
b) SORT BY
c) GROUP BY
d) RANK BY
Answer: a) ORDER BY
26) Which of the following is a valid MySQL data type for storing binary data?
a) BLOB
b) TEXT
c) VARCHAR
d) INT
Answer: a) BLOB
27) Which MySQL command is used to restore a backup of a database or table?
a) RESTORE DATABASE
b) CREATE RESTORE
c) LOAD DATA
d) IMPORT DATABASE
Answer: c) LOAD DATA
28) Which of the following is not a valid function in MySQL?
a) ROUND()
b) CEILING()
c) FLOOR()
d) TRUNCATE()
Answer: d) TRUNCATE()
29) Which MySQL command is used to view the structure of a table?
a) DESC
b) SHOW TABLE
c) STRUCTURE
d) GET TABLE
Answer: a) DESC
30) Which of the following is not a valid MySQL data type for storing numeric values?
a) INT
b) FLOAT
c) DECIMAL
d) STRING
Answer: d) STRING
31) Which command in MySQL is used to insert new data into a table?
a) INSERT INTO
b) UPDATE
c) REPLACE
d) ADD
Answer: a) INSERT INTO
32) In MySQL, which clause is used to group the result set based on one or more columns?
a) GROUP BY
b) ORDER BY
c) HAVING
d) WHERE
Answer: a) GROUP BY
33) Which of the following is not a valid MySQL function for working with strings?
a) SUBSTRING()
b) CONCAT()
c) REPLACE()
d) INDEX()
Answer: d) INDEX()
34) Which MySQL command is used to create a new user?
a) CREATE USER
b) ADD USER
c) SET USER
d) INSERT USER
Answer: a) CREATE USER
35) In MySQL, which statement is used to update existing rows in a table?
a) ALTER
b) UPDATE
c) MODIFY
d) REPLACE
Answer: b) UPDATE
36) Which of the following is not a valid MySQL function for working with dates and times?
a) ADDDATE()
b) DATEDIFF()
c) TIMEADD()
d) TIMEFORMAT()
Answer: c) TIMEADD()
37) In MySQL, which statement is used to delete rows from a table?
a) DELETE
b) REMOVE
c) DROP
d) TRUNCATE
Answer: a) DELETE
38) Which MySQL function is used to return the current time zone?
a) TIMEZONE()
b) CURRENT_TIMEZONE()
c) SESSION_TIMEZONE()
d) SYSTEM_TIMEZONE()
Answer: c) SESSION_TIMEZONE()
39) In MySQL, which clause is used to filter the result set based on a condition that must be met for the group?
a) HAVING
b) GROUP BY
c) ORDER BY
d) WHERE
Answer: a) HAVING
40) Which MySQL command is used to rename a table?
a) ALTER TABLE
b) MODIFY TABLE
c) CHANGE TABLE
d) RENAME TABLE
Answer: d) RENAME TABLE
41) Which of the following is not a valid MySQL function for working with arrays?
a) ARRAY_CONTAINS()
b) ARRAY_LENGTH()
c) ARRAY_REMOVE()
d) ARRAY_PUSH()
Answer: d) ARRAY_PUSH()
42) In MySQL, which statement is used to insert multiple rows into a table at once?
a) ADD ROWS
b) MULTI ROW INSERT
c) INSERT INTO
d) INSERT ALL
Answer: c) INSERT INTO
43) Which MySQL function is used to return the string length of a value?
a) CHAR_LENGTH()
b) SUBSTR()
c) LENGTH()
d) STR_LENGTH()
Answer: c) LENGTH()
44) Which of the following is not a valid MySQL data type for storing large text values?
a) TINYTEXT
b) MEDIUMTEXT
c) LONGTEXT
d) BLOB
Answer: d) BLOB
45) In MySQL, which statement is used to update or insert rows into a table depending on whether a matching row already exists?
a) REPLACE
b) INSERT IGNORE
c) INSERT INTO
d) UPDATE
Answer: a) REPLACE
46) Which MySQL command is used to add a primary key to an existing table?
a) ALTER TABLE
b) MODIFY TABLE
c) ADD PRIMARY KEY
d) CHANGE TABLE
Answer: c) ADD PRIMARY KEY
47) Which MySQL function is used to return the current UTC date and time?
a) UTC_TIMESTAMP()
b) CURRENT_TIMESTAMP()
c) NOW()
d) TIMESTAMP()
Answer: a) UTC_TIMESTAMP()
48) In MySQL, which statement is used to rename a column in a table?
a) ALTER TABLE
b) MODIFY COLUMN
c) RENAME COLUMN
d) CHANGE COLUMN
Answer: d) CHANGE COLUMN
49) Which of the following is not a valid MySQL data type for storing Boolean values?
a) BOOL
b) TINYINT
c) SMALLINT
d) BOOLEAN
Answer: c) SMALLINT
50) In MySQL, which statement is used to replicate data from one server to another?
a) REPLICATE
b) COPY
c) BACKUP
d) MASTER-SLAVE
Answer: d) MASTER-SLAVE
- Top 10 DevOps Trainers in the world - October 7, 2023
- What is Cookies and Why it is Used? - May 24, 2023
- TOP trends of transitions in TikTok - May 10, 2023