MySQL Questions and Answers – Table Creation

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

Answer: a
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

Answer: d
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

Answer: a
Explanation: None.
advertisement
advertisement

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

Answer: a
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

Answer: a
Explanation: None.
Note: Join free Sanfoundry classes at Telegram or Youtube

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

Answer: a
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

Answer: d
Explanation: None.
advertisement

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

Answer: c
Explanation: Primary key is an essential attribute for each table declared in Mysql.
advertisement

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

Answer: d
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

Answer: a
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.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.