0% found this document useful (0 votes)
25 views

MySQL MCQ

The document contains a series of questions and answers related to MySQL, covering topics such as database structure, SQL commands, data types, and MySQL functionalities. Each question is followed by multiple-choice answers, with the correct answer provided for each. The content serves as a quiz or study guide for individuals looking to test or enhance their knowledge of MySQL.

Uploaded by

Danish Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views

MySQL MCQ

The document contains a series of questions and answers related to MySQL, covering topics such as database structure, SQL commands, data types, and MySQL functionalities. Each question is followed by multiple-choice answers, with the correct answer provided for each. The content serves as a quiz or study guide for individuals looking to test or enhance their knowledge of MySQL.

Uploaded by

Danish Alam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

MySQL important Question

1. MySQL is freely available and is open source.


a) True b) False c) Not sure d) Private
Ans. a

2. What represents a ‘tuple’ in a relational database?


a) Table b) Row c) Column d) Object
Ans. b

3. How is communication established with MySQL?


a) SQL
b) Network calls
c) A programming language like C++
d) APIs`
Ans. a

4. Which of the following clauses is used to display information that match a given pattern?
a) LIKE
b) WHERE
c) IS
d) SAME
Answer: a
Explanation: The ‘LIKE’ clause filters information that match a given pattern. ‘WHERE’ clause selects
information that is specified by a condition. ‘IS’ is used to match the exact condition specified.

5. What column names are displayed when this SQL command is executed?
SHOW COLUMNS FROM tbl_name LIKE '%name';
a) suffixed with ‘name’
b) prefixed with ‘name’
c) suffixed with ‘%name’
d) prefixed with ‘%name’
Answer: a
Explanation: The wildcard ‘%’ is used to indicate that any number of characters can replace it. All column
names that end in ‘name’ are displayed. Additional information of columns like type and size are listed.
6. The special database that always exists after setting up MySQL in a computer is
a) sampdb b) my_sql c) information_schema d) readme_db
Ans. c

7. Identify the table name in the following SQL statement.


INSERT INTO student VALUES('Kyle','M',NULL);
a) Student
b) Values
c) Kyle
d) M
Answer: a
Explanation: The ‘INSERT INTO’ clause here inserts a row in the table named ‘student’. The table has three
fields. The first field or attribute value in the row/tuple is ‘Kyle’. The second attribute value is ‘M’ and the
last attribute is set to NULL.

8. What is ‘xyz’ in the following SQL statement?


SELECT abc FROM xyz;
a) row name
b) column name
c) table name
d) database name
Answer: c
Explanation: The SELECT clause is used to retrieve information from some specified tables. It follows a
specified format for information retrieval. Here, ‘abc’ can be a column name. It must be present in the
table ‘xyz’.

9. Which operator is used to perform integer divisions in MySQL?


a) / b) \ c) DIV d) //
Answer: c
Explanation: The operator ‘DIV’ is used to perform integer divisions in MySQL. ‘//’ is used in languages like
Python to do the same. The operator ‘/’ performs floating point divisions and ‘\’ is facilitates escape
sequences.

10. The NULL value also means


a) value equal to zero b) unknown value
c) negative values d) a large value
Answer: b
Explanation: The NULL value in MySQL is a special value. It represents ‘no value’ or an ‘unknown value’. A
NULL value can’t be compared like normal known values since it gives undesirable results.

11. What does comparing a known value with NULL result into?
a) zero b) a positive value c) a negative value d) null
Ans. d
12. Which clause is used to sort query elements?
a) GROUP
b) GROUP BY
c) ORDER
d) ORDER BY
Ans. d

13. The query ‘SELECT NOW()’ shows the current


a) table
b) time only
c) date only
d) date and time
Answer: d
Explanation: SELECT NOW() is an SQL query. It shows both the current date and the current time. It is
generally displayed in the format ‘yyyy-mm-dd hh-mm-ss’. For example, 2009-04-21 11-51-36.

14. Suppose you want to select a database named ‘sampledb’ as the default database. Which of the
following commands do you use?
a) SELECT DATABASE()
b) SELECT DATABASE sampledb
c) USE DATABASE sampledb
d) USE sampled
Answer: d
Explanation: ‘USE sampledb’ selects sampledb as the default database. Initially, ‘SELECT DATABASE();’
command displays ‘NULL’, since no database is selected by default. The other two are not valid commands.

15. What does ‘abc’ & ‘xyz’ specify in the following SQL statement?
CREATE TABLE abc (xyz);
a) table name and column specs
b) column specs and table name
c) table name and number of columns
d) table name and number of rows
Ans. a

16. To see the table structure, which of the following SQL commands is issued?
a) DESCRIBE tbl_name
b) VIEW tbl_name
c) SELECT TABLE tbl_name
d) SELECT tbl_name
Ans. a
17. MySQL can be used to execute script files.
a) True b) False
Ans. a

18. In which language MySQL is written?


a) Python
b) C/C+
c) Java
d) COBOL
Ans. b

19. Is a semicolon necessary after every query?


a) TRUE b) FALSE
Ans. a

20. To know your MYSQL version and current date which of the following command you should use?
a) VERSION, CURRENT_DATE();
b) SELECT VERSION, CURRENTDATE();
c) SELECT VERSION(), CURRENT_DATE;
d) SELECT VERSON(),CURRENT_DATE();
Ans. c

21. In which form MYSQL query results are displayed?


a) LIST b) TUPLE c) ROWS AND COLUMNS d) LIST AND TUPLES BOTH
Ans. c

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


a) YES
b) NO
Ans. a

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


a) YES
b) NO
Ans. a

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


a) Show database;
b) Show databases;
c) Show database();
d) Show_all
database; Ans. b
25. In the following statement, what do you mean by the 'student'?
USE student;
a) Database name b) Row name
c) Column name d) Table name
Ans. a

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


a) DELETE DATABASE_NAME;
b) DROP DATABASE_NAME;
c) DROP DATABASE DATABASE_NAME;
d) DELETE DATABASE DATABASE_NAME;
Ans. c

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


a) DML
b) DDL
c) DCL
d) DQL
Ans. b

28. Which of the following is the correct syntax to add a field using alter command?
a) ALTER TABLE table_name ADD field_name data type;
b) ALTER TABLE table_name, field_name data type;
c) ALTER TABLE field_name data type;
d) None of these
Ans. a

29. 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?
a) DELETE
b) TRUNCATE
c) DROP
d) CLEAR
Ans. b

30. Which of the following is the correct syntax for using the TRUNCATE statement?
a) TUNCATE TABLE-NAME;
b) TRUNCATE TABLE-NAME DATABASE-NAME;
c) TRUNCATE TABLE TABLE-NAME;
d) TRUNCATE DATABASE-NAME TABLE-NAME;
Ans. c
31. Suppose you have 1000 records and you only want 100 records which of the following clause you will
use?
a) SET LIMIT
b) LIMIT
c) HAVING
d) GROUP BY
Ans. b

32. Which operator checks whether the particular condition record exists in the table or not?
a) Exists
b) Is null
c) Not null
d) In
Ans. a

33. Which SQL command is used for granting or revoking the rights?
a) DML (Data Manipulation language)
b) DDL (Data definition language)
c) DCL (Data control language)
d) DQL (Data Query Language)
Ans. c

34. Which key helps us to establish the relationship between two tables?
a) Candidate key
b) Foreign key
c) Primary key
d) Unique key
Ans. b

35. SELECT is a type of which SQL command?


a) DML
b) DDL
c) DCL
d) DQL
Ans. d

36. Which SQL commands are used for manipulation/ modifying the data present in the table?
a) DML
b) DDL
c) DCL
d) DQL
Ans. a
37. If you want to add a row in a table then which command you will use?
a) INSERT INTO b) ADD
c) ALTER d) CREATE
Ans. a

38. Which of the following data type is used when it comes to store images in your database?
a) BIG INT b) BLOB c) VARCHAR d) INT
Ans. b

39. “CREATE TABLE…” Command is used to create which type of table in MySQL?
a) Permanent Table b) Virtual Table
c) Temporary Table d) All of these
Ans. a

40. The father of MySQL is .


a) Michael Widenius
b) Bill Joy
c) Bill Gates
d) Stephanie Wall
Ans. a

41. To use MySQL on your computer, you’ll need


a) Perl, PHP or Java
b) Some sort of client program to access the database
c) A browser
d) FTP and
Telnet Ans. b

42. Commands passed to the MySQL daemon are written in


a) Your choice from Perl, PHP, Java or some other language
b) English
c) The structure Query language
d) Swedish
Ans. c

43. MySQL runs on which operating systems?


a) Unix and Linux only
b) Linux and Mac OS-X only
c) Unix, Linux, Windows and others
d) Any operating system at all
Ans. c
44. MySQL Access security is controlled through
a) MySQL login accounts, and priveliges set for each account
b) The ID that the user logged into the server through, and priveliges set up for that account
c) A table of valid IP addresses, and priveliges set up for each IP address
d) The normal login security is sufficient for MySQL, and it does not have any extra controls of its own
Ans. a

45. If you want to undo a GRANT, you should use


a) REVOKE b) UNDO c) UNGRANT d) DELETE
Ans. a

46. How many distinct, different values can you hold in an enum field?
a) 255 b) 7
c) 65535 d) 2
Ans. c

47. Which of the following is NOT available in MySQL?


a) REVOKE
b) HEAD
c) LIKE
d) JOIN
Ans. b

48. The program called MySQL is


a) There isn’t program just called MySQL
b) A wrapper through which java clients must connect to the database
b) A client program that lets you send SQL commands to the database engine
d) The database engine
Ans. c

49. In a LIKE clause, you can ask for any 6 letters value by writing:
a) LIKE (That is six underscore characters)
b) LIKE .{6}
c) LIKE ??????
d) LIKE ……
Ans. a

50. Storing same data in many places is called…….


a) Iteration
b) Redundancy
c) Enumeration
d) Concurrency
Ans. b
51. Which level of abstraction describes what data are stored in the Database?
a) View level
b) Logical level
c) Physical level
d) Abstraction level
Ans. b

52. Which of the following is true of MySQL?


a) It is license free for most applications
b) It is written in C and C++ language
c) It was owned and sponsored by the Swedish company MySQL LAB
d) All of the above
Ans. d

53. Which of the following is not a SQL keyword?


a) DELETE b) CREATE c) SELECT d) REMOVE
Ans. d

54. The privilege can be granted to retrieve data.


a) READ
b) SELECT
c) UPDATE
d) RETRIEVE
Ans. b

55. Databases are stored in so that they are available when needed.
a) data mines
b) data matrices
c) data sources
d) data dashboards
Ans. b

56. MySQL is an example of the .


a) Hierarchical model
b) Relational data model
c) File system data model
d) XML data model
Ans. b

57. The relational data model was developed in the .


a) 1970s
b) 1979s
c) 1980s
d) 1960s
Ans. a
58. ACID properties of a transactions are
a) Atomicity, consistency, isolation, database
b) Atomicity, consistency, isolation, durability
c) Atomicity, consistency, integrity, durability
d) Atomicity, consistency, integrity, database
Ans. b

59. Commit command is used for


a) To restore the old values b) To save the current table
c) To save the current transaction d) To recover the old table
Ans. c

60. The value of Primary key


a) can be duplicated
b) can be null
c) cannot be null
d) none of these
Ans. c

61. DCL is used to ?


a) Manage the changes made by DML statements
b) Inserting, Deleting and Updating data
c) Control access to data stored in a database
d) None of these
Ans. c

62. TCL is used for ?


a) Manage the changes made by DML statements
b) Defining database schema
c) Control access to data stored in a database
d) None of these
Ans. a

63. What is Granularity?


a) The size of data items b) The size of database
c) The size of record d) The size of file
Ans. b

64. Data warehouse provides


a) Transaction Responsiveness
b) Demand and Supply Responsiveness
c) Storage, Functionality Responsiveness to queries
d) None of these
Ans. c
65. is process of extracting previously non known valid and actionable information form large data
to make crucial business and strategic decisions.
a) Data Management
b) Database
c) Data Mining
d) Meta Data
Ans. c

66. BCNF stands for


a) Binary Coded Normal Form
b) Boyce – Codd Normal Form
c) Bit Code Normal Form
d) Boyce Codd Natural
Form Ans. b

67. The student marks should not be greater than 100. This is
a) Integrity constraint
b) Referential constraint
c) Over-defined constraint
d) Feasible constraint
Ans. a

68. The data type BLOB stands for:


a) Binary Large Object
b) Big List Object
c) Binary List Object
d) None of these
Ans. a

69. What is the full form of SQL?


a) Structured Query List
b) Structured Query Language
c) Sample Query Language
d) None of these
Ans. b

70. Which of the following is not a valid SQL type?


a) FLOAT
b) NUMERIC
c) DECIMAL
d) CHARACTER
Ans. c
71. Which of the following are TCL commands?
a) COMMIT and ROLLBACK
b) UPDATE and TRUNCATE
c) SELECT and INSERT
d) GRANT and REVOKE
Ans. a

72. How many Primary keys can have in a table?


a) Only 1
b) Only 2
c) Depends on no of Columns
d) Depends on DBA
Ans. a

73. Which datatype can store unstructured data in a column?


a) CHAR b) RAW c) NUMERIC d) VARCHAR
Ans. b

74. Which of the following is not a valid aggregate function?


a) COUNT b) COMPUTE c) SUM d) MAX
Ans. b

75. Which operator is used to compare a value to a specified list of values?


a) ANY b) BETWEEN c) ALL d) IN
Ans. d

76. What operator tests column for absence of data


a) NOT Operator b) Exists Operator
c) IS NULL Operator d) None of these
Ans. c

77. In which of the following cases a DML statement is not executed?


a) When existing rows are modified
b) When a table is deleted
c) When some rows are deleted
d) All of these
Ans. b

78. command makes the updates performed by the transaction permanent in the database?
a) ROLLBACK
b) COMMIT
c) TRUNCATE
d) DELETE
Ans. b
79. A CASE SQL statement is ?
a) A way to establish a loop in SQL
b) A way to establish an IF-THEN-ELSE in SQL
c) A way to establish a data definition in SQL
d) All of these
Ans. b

80. Which of the following is the basic approaches for joining tables?
a) Union JOIN b) Natural JOIN c) Subqueries d) All of these
Ans. d

81. Why we need to create an index if the Primary key is already present in a table?
a) Index improves the speed of data retrieval operations on a table
b) Index are special lookup tables that will be used by the database search engine
c) Indexes are synonyms of a column in a table
d) All of these
Ans. a

82. Group of operations that form a single logical unit of work is known as
a) View b) Network
c) Unit d) Transaction
Ans. d

83. A sequence in SQL can generate a maximum number:


a) 39 digits
b) 38 digits
c) 40 digits
d) 37 digits
Ans. b

84. Which of the following is the correct order of a SQL statement?


a) SELECT, GROUP BY, WHERE, HAVING
b) SELECT, WHERE, GROUP BY, HAVING
c) SELECT, HAVING, WHERE, GROUP BY
d) SELECT, WHERE, HAVING, GROUP
BY Ans. b

85. What is the difference between a PRIMARY KEY and a UNIQUE KEY?
a) Primary key can store null value, whereas a unique key cannot store null value
b) We can have only one primary key in a table while we can have multiple unique keys
c) Primary key cannot be a date variable whereas unique key can be
d) None of these
Ans. b
86. When the wildcard in a WHERE clause is useful?
a) When an exact match is required in a SELECT statement
b) When an exact match is not possible in a SELECT statement
c) When an exact match is required in a CREATE statement
d) When an exact match is not possible in a CREATE
statement Ans. b

87. is NOT a type of constraint in SQL language?


a) FOREIGN KEY
b) PRIMARY KEY
c) UNIQUE
d) ALTERNATE KEY
Ans. d

88. is a program that perform some common action on database data and also stored in the
database.
a) Stored Procedure
b) Trigger
c) Stored Function
d) None of these
Ans. a

89. What is data in a MySQL database organized into?


a) Objects
b) Tables
c) Networks
d) File systems
Ans. a

90. What represents an ‘attribute’ in a relational database?


a) Table b) Row c) Column d) Object
Ans. c

91. What does ‘name’ represent in the following SQL code snippet?
CREATE TABLE student
(
name CHAR(30),
roll_num INT,
address CHAR(30),
phone CHAR(12)
);
a) A table b) A row c) A column d) An object
Ans. c
92. The number of attributes in the following SQL table is
CREATE TABLE employee (
emp_name CHAR(30),
emp_id INT
);
a) 30 b) 1 c) 2 d) 3
Ans. c

93. Which MySQL function is used to get the current date and time?
a) DATETIME() b) TODAY()
c) DATE() d) NOW()
Ans. d

You might also like