This set of MySQL Multiple Choice Questions & Answers (MCQs) focuses on “Table Creation”.
1. Which among the following is the correct syntax for creating table?
a) CREATE TABLE name;
b) CREATE name;
c) CREATE TABLE
d) All of the mentioned
View Answer
Explanation: None.
2. What is the role of “CONSTRAINS” in defining a table in Mysql?
a) Declaring primary key
b) Declaring Foreign Key
c) Restrictions on columns
d) All of the mentioned
View Answer
Explanation: None.
3. Which command is used for the table definition in Mysql?
a) DESC table_name;
b) DESC table_name
c) DESC
d) None of the mentioned
View Answer
Explanation: None.
4. Which among the following is the correct syntax for defining “Constraint Check” in Mysql?
a) gender char(1) check( gender IN (‘M’, ‘F’)),
b) gender char (1) check,
c) gender char (1) check ( gender ),
d) none of the mentioned
View Answer
Explanation: Check constraint constrains the allowable values for a particular column.
5. Which data type character merges the “Check Constraint” into a data type definition?
a) ENUM
b) ENUM1
c) ENUM2
d) None of the mentioned
View Answer
Explanation: None.
6. Which among the following is the correct syntax for defining “ENUM” in Mysql?
a) gender ENUM (‘M’, ‘F’),
b) gender ENUM,
c) gender ENUM ( ),
d) none of the mentioned
View Answer
Explanation: None.
7. Which among the following are the correct definitions for “NULL” in Mysql?
a) Absence of value
b) Unknown
c) Empty set
d) All of the mentioned
View Answer
Explanation: None.
8. Find out the logical error in the following MySQL code snippet?
CREATE TABLE person ( person_id VARCHAR(20), Name VARCHAR (20), Address VARCHAR (20), Mobile_no SMALLINT );
a) Lesser number of columns
b) Incorrect definition
c) Primary key is missing
d) None of the mentioned
View Answer
Explanation: Primary key is an essential attribute for each table declared in Mysql.
9. What is the meaning of “REFERENCES” in table definition?
a) Primary key
b) NULL
c) Foreign Key
d) A ”foreign Key” belong to this particular table
View Answer
Explanation: When “Foreign Key” declared in a table then it necessary to define the name of the table to which it belong with help of constraint “REFERENCES”.
10. What default value gets stored in columns of the table?
a) NULL
b) 0
c) 1
d) -1
View Answer
Explanation: NULL is the default value as it stands for “Absence of value”.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Apply for Programming Internship
- Check Information Technology Books
- Practice Programming MCQs
- Check MySQL Books