×

Multiple-Choice Questions

Web Technologies MCQs

Computer Science Subjects MCQs

Databases MCQs

Programming MCQs

Testing Software MCQs

Digital Marketing Subjects MCQs

Cloud Computing Softwares MCQs

AI/ML Subjects MCQs

Engineering Subjects MCQs

Office Related Programs MCQs

Management MCQs

More

MySQL Multiple-Choice Questions (MCQs)

MySQL is the most common open-source software, nowadays every other person relies on MySQL for its database. As it is open source so anyone in this world can use this system. This system is developed by ORACLE cooperation.

MySQL MCQs: This section contains multiple-choice questions and answers on the various topics of MySQL. Practice these MCQs to test and enhance your skills on MySQL.

List of MySQL MCQs

1. In which language MYSQL is written?

  1. PYTHON
  2. C/C+
  3. JAVA
  4. COBOL

Answer: B) C/C++

Explanation:

MYSQL is written in C / C++.

Discuss this Question


2. To see the list of options provided by MYSQL which of the following command is used?

  1. HELP
  2. –HELP
  3. -- HELP
  4. ELP-

Answer: C) -- HELP

Explanation:

To see the list of options provided by MYSQL we use -- HELP.

Discuss this Question


3. What do you mean by HOST in MYSQL?

  1. HOST is the user name.
  2. HOST is the representation of where the MYSQL server is running.
  3. HOST is the administration’s machine name.

Answer: B) HOST is the representation of where the MYSQL server is running.

Explanation:

HOST is the representation of where the MYSQL server is running.

Discuss this Question


4. Is a semicolon necessary after every query?

  1. TRUE
  2. FALSE

Answer: A) TRUE

Explanation:

It is important to put a semicolon after every query.

Discuss this Question


5. To know your MYSQL version and current date which of the following command you should use?

  1. VERSION, CURRENT_DATE();
  2. SELECT VERSION, CURRENTDATE();
  3. SELECT VERSION(), CURRENT_DATE;
  4. SELECT VERSON(),CURRENT_DATE();

Answer: C) SELECT VERSION (), CURRENT_DATE;

Explanation:

SELECT VERSION (), CURRENT_DATE; is the command to check the current MYSQL version and date.

Discuss this Question


6. In which form MYSQL query results are displayed?

  1. LIST
  2. TUPLE
  3. ROWS AND COLUMNS
  4. LIST AND TUPLES BOTH

Answer: C) ROWS AND COLUMNS

Explanation:

MYSQL query results are displayed in the form of ROWS AND COLUMNS.

Discuss this Question


7. What does the marked time represent in the given picture?

MYSQL MCQ 7
  1. CPU TIME
  2. MACHINE TIME
  3. WALL CLOCK TIME

Answer: C) WALL CLOCK TIME

Explanation:

The time marked in the picture represents the WALL CLOCK TIME because this time is affected by server load and network latency.

Discuss this Question


8. In MYSQL, can we write keywords in any letter case?

  1. YES
  2. NO

Answer: A) YES

Explanation:

YES, in MYSQL we can write keywords in any letter case.

Discuss this Question


9. In MYSQL, can you write multiple statements in a single line?

  1. YES
  2. NO

Answer: A) YES

Explanation:

YES, we can write multiple statements in a single line, we just have to separate them with a semicolon.

Discuss this Question


10. If you want to stop the processing query then which of the following command you should use?

  1. QUIT
  2. STOP
  3. /c
  4. C and D both

Answer: C) /c

Explanation:

To stop the processing query the /c command is used.

Discuss this Question


11. To see all the databases which command is used?

  1. Show database;
  2. Show databases;
  3. Show database();
  4. Show_all database;

Answer: B) Show databases;

Explanation:

To see all the databases SHOW DATABASES; command is used.

Discuss this Question


12. Can we create a database named 01_test?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes we can create a database named 01_test.

Discuss this Question


13. In the following statement, what do you mean by the 'student'?

USE student;
  1. Database name
  2. Row name
  3. Column name
  4. Table name

Answer: A) Database name

Explanation:

In USE student, 'student' represents the database named.

Discuss this Question


14. If our database name is 'schooldb' and we want to drop this database will the query work if we will write our database name in capital letters?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

We can write any case while using a drop statement.

Discuss this Question


15. Which of the following command is used to delete a database?

  1. DELETE DATABASE_NAME;
  2. DROP DATABASE_NAME;
  3. DROP DATABASE DATABASE_NAME;
  4. DELETE DATABASE DATABASE_NAME;

Answer: C) DROP DATABASE DATABASE_NAME;

Explanation:

DROP DATABASE DATABASE_NAME; command is used to delete a database.

Discuss this Question


16. ALTER command is a type of which SQL command?

  1. DML
  2. DDL
  3. DCL
  4. DQL

Answer: B) DDL

Explanation:

ALTER command is a type DDL (data definition language) SQL command.

Discuss this Question


17. Which of the following is the correct syntax to add a field using alter command?

  1. ALTER TABLE table_name ADD field_name data type;
  2. ALTER TABLE table_name, field_name data type;
  3. ALTER TABLE field_name data type;

Answer: A) ALTER TABLE table_name ADD field_name data type;

Explanation:

To add a field using alter statement following syntax should be followed:

ALTER TABLE table_name ADD field_name data type;

Discuss this Question


18. Can you change the column name using alter command?

  1. Yes
  2. No

Answer: A) Yes

Explanation:

Yes, we can easily change the column name using alter command.

Discuss this Question


19. Suppose you have a table named to test and inside this table you have a column named CGPA now if you are asked to change the column named CGPA to total percentage, using alter command then which of the following statement you will write?

  1. ALTER TABLE test CHANGE COLUMN 'cgpa’ 'total_percentage’ int;
  2. ALTER test table CHANGE 'cgpa’ ,'total_percentage’ int;
  3. ALTER TABLE test CHANGE 'cgpa 'total_percentage’ int;

Answer: A) ALTER TABLE test CHANGE COLUMN 'cgpa’ 'total_percentage’ int;

Explanation:

we will use the following syntax,

ALTER TABLE test CHANGE COLUMN 'cgpa' 'total_percentage' int;

Discuss this Question


20. Suppose you are asked to drop a column using alter statement then which syntax you will follow?

  1. ALTER table_name TABLE DROP COLUMN column_name;
  2. ALTER TABLE table_name DROP COLUMN column_name;

Answer: B) ALTER TABLE table_name DROP COLUMN column_name;

Explanation:

we will use the following syntax,

ALTER TABLE table_name DROP COLUMN column_name;

Discuss this Question


21. What does the show tables command do?

  1. It displays all the tables of all the databases in the machine.
  2. It displays all the tables of a particular database.
  3. It only displays the current table.

Answer: B) It displays all the tables of a particular database.

Explanation:

show tables command displays all the tables of a particular database.

Discuss this Question


22. Is it important to provide where condition with update statement in MYSQL?

  1. YES
  2. NO

Answer: A) YES

Explanation:

YES it is important to provide the where condition with an update statement else the entire column will have the same updated value.

Discuss this Question


23. Suppose you have two columns named student_name and student_department inside table student_details and you are asked to update the value of these two columns where ID=4 then what statement you will write?

  1. UPDATE student_details SET Student_name="ram", Student_department='Chemical' WHERE ID='4';
  2. UPDATE table student_details SET column_name Student_name="ram", Student_department='Chemical' WHERE ID='4';
  3. UPDATE student_details SET Student_name="ram" and Student_department='Chemical' WHERE ID='4';

Answer: A) UPDATE student_details SET Student_name="ram", Student_department='Chemical' WHERE ID='4';

Explanation:

According to the given situation we will write,

UPDATE student_details SET Student_name="ram", Student_department='Chemical' WHERE ID='4';

Discuss this Question


24. What is the function of DESCRIBE statement?

  1. This statement helps us to get the details of the entire row.
  2. This statement helps us to get the definition of a particular table at a time.
  3. This statement helps us to get the definition of all the tables.

Answer: B) This statement helps us to get the definition of a particular table at a time.

Explanation:

DESCRIBE statement helps us to get the definition of a particular table at a time, it tells us about all the constraints which are applied to columns.

Discuss this Question


25. If you are asked to delete the entire data of a table without disturbing the table definition then in such case which statement you will use?

  1. DELETE
  2. TRUNCATE
  3. DROP
  4. CLEAR

Answer: B) TRUNCATE

Explanation:

To only remove the data of the table without disturbing the definition of the table we use the TRUNCATE statement, this statement helps us to delete all the data of a table.

Discuss this Question


26. Which of the following is the correct syntax for using the TRUNCATE statement?

  1. TUNCATE TABLE-NAME;
  2. TRUNCATE TABLE-NAME DATABASE-NAME;
  3. TRUNCATE TABLE TABLE-NAME;
  4. TRUNCATE DATABASE-NAME TABLE-NAME;

Answer: C) TRUNCATE TABLE TABLE-NAME;

Explanation:

The correct syntax to use truncate statement is,

TRUNCATE TABLE TABLE-NAME;

Discuss this Question


27. From all the clauses in MYSQL what task is performed by the DISTINT clause?

  1. It returns us the duplicate values
  2. It returns us the unique values
  3. It returns us the NULL values;

Answer: B) It returns us the unique values

Explanation:

If we only want to keep unique records then in that case we can simply use the DISTINCT Clause.

Discuss this Question


28. Suppose you have 1000 records and you only want 100 records which of the following clause you will use?

  1. SET LIMIT
  2. LIMIT
  3. HAVING
  4. GROUP BY

Answer: B) limit clause

Explanation:

The LIMIT clause helps us to set a limit to records we want in return as a result.

Discuss this Question


29. What will the following statement return?

SELECT * FROM student_details WHERE Student_name LIKE 'S%';

Where student_details is the table name and student_name is the column name?

  1. It will return the name starting with s
  2. It will return the name ending with s
  3. It will return the name who has s in between

Answer: A) It will return the name starting with s

Explanation:

The statement will return the name starting with s

Discuss this Question


30. Suppose you are asked to display all the names which have 'a' as their second character then which query pattern you will use?

  1. _ _ a%;
  2. _a_;
  3. _a%;
  4. _%a;

Answer: C) _a%;

Explanation:

To know the name who has an as its second character we will write: _a%;

Discuss this Question


31. If you are asked to find out the names which only have 5 characters then what query pattern you will use?

  1. %%%%%
  2. _%_%_
  3. _____
  4. --%%-

Answer: C) _____

Explanation:

If we are asked to find out the names which only have 5 characters, we will put 5 underscores _____.

Discuss this Question


32. State whether the statement is true or false? 'PRIMARY KEY and UNIQUE KEY both are the same'

  1. TRUE
  2. FALSE

Answer: B) FALSE

Explanation:

No, UNIQUE key and PRIMARY both are different in many ways.

Discuss this Question


33. Can we have more than 1 primary key in a table?

  1. TRUE
  2. FALSE

Answer: B) FALSE

Explanation:

No, in a table we can only have 1 primary key.

Discuss this Question


34. A variable that has a primary key constraint can have any data type other than INT?

  1. TRUE
  2. FALSE

Answer: B) FALSE

Explanation:

PRIMARY KEY constraints should always have a numerical value.

Discuss this Question


35. Which key is commonly known as a subset of a super key?

  1. Candidate key
  2. Foreign key
  3. Primary key
  4. Unique key

Answer: A) Candidate key

Explanation:

Candidate key is commonly known as a subset of the super key.

Discuss this Question


36. Numbers of super keys always more than the number of candidate keys?

  1. True
  2. False

Answer: A) True

Explanation:

The super key is the super set so therefore we can have many super keys in a table

Discuss this Question


37. Which key is the minimal set of super keys?

  1. Candidate key
  2. Foreign key
  3. Primary key
  4. Unique key

Answer: A) Candidate key

Explanation:

Candidate key is the minimal set of super keys.

Discuss this Question


38. Which key helps us to establish the relationship between two tables?

  1. Candidate key
  2. Foreign key
  3. Primary key
  4. Unique key

Answer: B) Foreign key

Explanation:

Foreign key helps us to establish the relationship between two tables.

Discuss this Question


39. Super key and candidate key can have NULL values?

  1. True
  2. False

Answer: A) True

Explanation:

The only similarity between super key and candidate key is that they both can have NULL as their values.

Discuss this Question


40. Which operator checks whether the particular condition record exists in the table or not?

  1. Exists
  2. Is null
  3. Not null
  4. In

Answer: A) Exists

Explanation:

The EXISTS operator checks whether the particular condition record exists in the table or not.

Discuss this Question


41. By default, the result of an order by clause is always displayed in which order?

  1. Ascending
  2. Descending

Answer: A) Ascending

Explanation:

By default, the result is always displayed in ascending order.

Discuss this Question


42. Which of the following syntax you will use to rename the table name?

  1. ALTER TABLE table_name RENAME TO new_table_name;
  2. RENAME new_table_name;
  3. ALTER table_name RENAME new_table_name;

Answer: A) ALTER TABLE table_name RENAME TO new_table_name;

Explanation:

To rename the table we will use:

ALTER TABLE table_name RENAME TO new_table_name;

Discuss this Question


43. 'MYSQL is the open source software' - What do you mean by this statement?

  1. This means anyone can use this software.
  2. This means you can contact the source of the software
  3. This means it gives the best security features

Answer: A) This means anyone can use this software.

Explanation:

An open-source software means anyone in this world can use this software, can inspect this software, and also modify it.

Discuss this Question


44. Which SQL command is used for granting or revoking the rights?

  1. DML
  2. DDL
  3. DCL
  4. DQL

Answer: C) DCL

Explanation:

Generally known as Data Control Language. These commands are used for granting or revoking the rights.

Discuss this Question


45. Which MySQL function is used to get the current date and time?

  1. DATETIME()
  2. TODAY()
  3. DATE()
  4. NOW()

Answer: D) NOW()

Explanation:

The NOW() function is used to get the current date and time in MySQL.

Discuss this Question


46. SELECT is a type of which SQL command?

  1. DML
  2. DDL
  3. DCL
  4. DQL

Answer: D) DQL

Explanation:

SELECT is a type of DQL command usually known as Data Query Language.

Discuss this Question


47. Which SQL commands are used for manipulation/ modifying the data present in the table?

  1. DML
  2. DDL
  3. DCL
  4. DQL

Answer: A) DML

Explanation:

Commonly known as Data Manipulation Language. As the name suggests, these commands are used for manipulation/ modifying the data present in the table.

Discuss this Question


48. If you want to add a row in a table then which command you will use?

  1. INSERT INTO
  2. ADD
  3. ALTER
  4. CREATE

Answer: A) INSERT INTO

Explanation:

INSERT INTO command helps us to add a row in a table.

Discuss this Question


49. Which type of join combines the result from both the tables and returns us the Cartesian product of the values?

  1. Right join
  2. Left join
  3. Inner join
  4. Cross join

Answer: D) Cross join

Explanation:

CROSS JOIN combines all the data from the first table and the second table. The result obtained through this join is the Cartesian product like every value will be multiplied with every other value of another table.

Discuss this Question


50. Which of the following data type is used when it comes to store images in your database?

  1. BIG INT
  2. BLOB
  3. VARCHAR
  4. INT

Answer: B) BLOB

Explanation:

These are commonly known as binary large objects. This data type (MySQL Data Types) is really important when you have to store a large set of binary data. As we have seen images have large addresses, so to store them we can use this data type. BLOB is case-sensitive. It can store up to 65535 bytes of data.

Discuss this Question




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.