MySQL MCQs

MySQL MCQs

Our experts have gathered these MySQL MCQs through research, and we hope that you will be able to see how much knowledge base you have for the subject of MySQL by answering these multiple-choice questions.
Get started now by scrolling down!

1: What identifies a row in a table as unique?

A.   Regular Key

B.   Main Key

C.   Primary Key

D.   Foreign Key

2: Which of the following is used to control case sensitivity?

A.   bit_or()

B.   binary

C.   bit_count()

D.   bit_and()

3: A ________ is a stored program that is attached to a table or a view.

A.   pseudofile

B.   trigger

C.   None of the above is correct.

D.   embedded SELECT statement

4: What are the statements used to manage transaction processing in MySQL?

A.   COMMIT and UNDO

B.   SAVE and ROLLBACK

C.   COMMIT and ROLLBACK

D.   SAVE and UNDO

5: What limits the type of data that goes into a table?

A.   Prevents Restrictions Limitations

B.   Constraints

6: With SQL, how do you select all the records from a table named "Persons" where the "FirstName" is "Peter" and the "LastName" is "Jackson"?

A.   SELECT * FROM Persons WHERE FirstName<>'Peter' AND LastName<>'Jackson'

B.   SELECT * FROM Persons WHERE FirstName='Peter' AND LastName='Jackson'

C.   SELECT FirstName='Peter', LastName='Jackson' FROM Persons

7: Which SQL statement is used to update data in a database?

A.   SAVE

B.   MODIFY

C.   SAVE AS

D.   UPDATE

8: What does SQL mean?

A.   Simplified Query Language

B.   Structured Query Language

9: What does SQL stand for?

A.   Structured Question Language

B.   Structured Query Language

C.   Strong Question Language

10: With SQL, how do you select all the columns from a table named "Persons"?

A.   SELECT * FROM Persons

B.   SELECT *.Persons

C.   SELECT Persons

D.   SELECT [all] FROM Persons

11: A table column can have null values

A.   false

B.   true

12: With SQL, how can you delete the records where the "FirstName" is "Peter" in the Persons Table?

A.   DELETE FROM Persons WHERE FirstName = 'Peter'

B.   DELETE ROW FirstName='Peter' FROM Persons

C.   DELETE FirstName='Peter' FROM Persons

13: Which SQL statement is used to insert new data in a database?

A.   ADD NEW

B.   INSERT INTO

C.   ADD RECORD

D.   INSERT NEW

14: It is possible to add a constraint after a table is created

A.   false

B.   true

15: A datatype can be changed after a table has been created.

A.   False

B.   True

16: Which of the following is not a valid aggregate function?

A.   COUNT

B.   MAX

C.   COMPUTE

D.   MIN

17: With SQL, how can you insert a new record into the "Persons" table?

A.   INSERT ('Jimmy', 'Jackson') INTO Persons

B.   INSERT VALUES ('Jimmy', 'Jackson') INTO Persons

C.   INSERT INTO Persons VALUES ('Jimmy', 'Jackson')

18: Which SQL statement is used to extract data from a database?

A.   GET

B.   EXTRACT

C.   OPEN

D.   SELECT

19: * in a SELECT statement portion does what?

A.   Nothing

B.   Multiply

C.   Select All

D.   Group By

E.   Assign a Pointer

20: Which SQL statement is used to delete data from a database?

A.   REMOVE

B.   ERASE

C.   COLLAPSE

D.   DELETE

21: Which is TRIGGER in Mysql ?

A.   Before Insert

B.   After Delete

C.   All

D.   Before Update

22: With SQL, how do you select a column named "FirstName" from a table named "Persons"?

A.   EXTRACT FirstName FROM Persons

B.   SELECT Persons.FirstName

C.   SELECT FirstName FROM Persons

23: With SQL, how do you select all the records from a table named "Persons" where the value of the column "FirstName" is "Peter"?

A.   SELECT * FROM Persons WHERE FirstName='Peter'

B.   SELECT * FROM Persons WHERE FirstName<>'Peter'

C.   SELECT [all] FROM Persons WHERE FirstName='Peter'

D.   SELECT [all] FROM Persons WHERE FirstName LIKE 'Peter'

24: MySQL is a tool to:

A.   develope websites

B.   manage users

C.   make Apps

D.   store data

E.   Store and manipulate data

25: How do you remove a table from the database

A.   REMOVE TABLE

B.   DESTROY TABLE

C.   DELETE TABLE

D.   DROP TABLE

26: Which of the following statements about Stored Procedures is true?

A.   They can provide a common set of database operations to multiple applications

B.   They allow you to store libraries of functions inside the database server

C.   They can improve security by limiting users to specific approved queries

D.   All of these

27: With SQL, how can you insert "Olsen" as the "LastName" in the "Persons" table?

A.   INSERT INTO Persons ('Olsen') INTO LastName

B.   INSERT ('Olsen') INTO Persons (LastName)

C.   INSERT INTO Persons (LastName) VALUES ('Olsen')

28: With SQL, how can you return all the records from a table named "Persons" sorted descending by "FirstName"?

A.   SELECT * FROM Persons ORDER BY FirstName DESC

B.   SELECT * FROM Persons ORDER FirstName DESC

C.   SELECT * FROM Persons SORT 'FirstName' DESC

D.   SELECT * FROM Persons SORT BY 'FirstName' DESC

29: How would you write a query to select all teams that won either 2, 4, 6 or 8 games?

A.   SELECT * FROM teams WHERE team_won like (2, 4, 6, 8);

B.   SELECT * FROM teams WHERE team_won IN (2, 4, 6, 8);

C.   SELECT * FROM teams WHERE team_won join (2, 4, 6, 8);

D.   SELECT * FROM teams WHERE team_won on (2, 4, 6, 8);

30: A SELECT statement without a WHERE clause returns _____.

A.   An error, because a SELECT statement is invalid without a WHERE clause.

B.   All of the rows from a table.

C.   All of the rows from a table that match the previous WHERE clause.

D.   Nothing.

31: Can I create another MySQL instance in the same machine?

A.   False

B.   True

32: What is the maximum number of constituents for a SET datatype?

A.   60

B.   66

C.   64

D.   62

33: With SQL, how can you return the number of records in the "Persons" table?

A.   SELECT COUNT(*) FROM Persons

B.   SELECT COUNT() FROM Persons

C.   SELECT COLUMNS(*) FROM Persons

D.   SELECT COLUMNS() FROM Persons

34: Which one of the following statements is correct?

A.   The ROLLUP modifier can only be used with the GROUP BY clause

B.   The WITH ROLLUP modifier will add an extra row to the results of a query.

C.   All of these

35: What is A in ACID?

A.   Atomicity

B.   Analysis Allow Alter

36: Which of the following clauses can be used in a SELECT statement to reduce the results to a unique list of values?

A.   REDUCE

B.   PRIMARY

C.   DISTINCT

D.   UNIQUE

37: What locks can be applied to MyISAM tables?

A.   Write

B.   Print

C.   Read and Print

D.   Read and Write

38: What does the following command output: 'SELECT 1'

A.   '1'

B.   1

C.   "1"

39: Which of the following queries returns all the rows whose names start with "S"?

A.   SELECT * FROM table WHERE name LIKE 'S%';

B.   None of these

C.   SELECT * FROM table WHERE name = 'S%';

D.   SELECT * FROM table WHERE name LIKE = 'S*';

40: Which SQL keyword is used to sort the result-set?

A.   ORDER

B.   ORDER BY

C.   SORT

D.   SORT BY

41: Having a key with a unique value for each row, best describes?

A.   PRIMARY KEY

B.   FIRST KEY

C.   FOREIGN KEY

D.   REFERENCE KEY

E.   UNIQUE KEY

42: Which set operator is used to combine the result sets of two or more SELECT statements?

A.   MERGE

B.   COMBINE

C.   UNION

D.   None of these

43: What function eliminates beginning and ending white space characters from a string?

A.   MTRIM()

B.   None of these

C.   STRIP()

D.   LTRIM()

E.   TRIM()

44: How do you rename a table?

A.   UPDATE

B.   CHANGE

C.   ALTER

D.   INSERT

E.   DELETE

45: In linux how do you restart the MySQL service?

A.   restart mysql service init 0 reboot

B.   /etc/init.d/mysql restart service mysqld restart

46: When a MySQL database is "normalized", by common definition, it means which of the following?

A.   That the database is organized in a way to reduce data redundancy. 1NF, 2NF, and 3NF forms are used as common guidelines.

B.   That the data returned within any given row is converted to a single object type as most appropriate (string, int, etc.).

C.   That the MySQL "strict" mode is invoked to avoid incompatibilities with legacy SQL.

D.   That common queries assigned to functions to simplify statements.

E.   That non-common characters are stripped from values to ensure compatibility with given character set.

47: Which of the following can add a row to a table?

A.   Alter

B.   Insert

C.   Add

D.   Update

48: I would like to retrieve the date with this format : dd/mm/YYYY in a field called btimestamp. Choose the correct way.

A.   SELECT DATE_FORMAT(btimestamp,'%d/%m/%Y') AS bdate FROM ...

B.   SELECT FORMAT_DATE(btimestamp,'%d/%m/%Y') AS bdate FROM ...

49: Which of these is not a valid name for a column

A.   Far

B.   From

C.   Near

D.   Under

50: TCL stands for ?

A.   Transactional Control Language

B.   Truncate Command Language

C.   Traffic Control Language