MySQL Questions and Answers – Populating & Modifying Tables – 1

This set of MySQL Multiple Choice Questions & Answers (MCQs) focuses on “Populating & Modifying Tables – 1”.

1. Which Statement is used to insert the values in the table?
a) INSERT INTO
b) Insert
c) INSERT
d) None of the mentioned
View Answer

Answer: a
Explanation: None.

2. Is it necessary to insert the value in each column of the table?
a) Yes
b) No
c) Depends on the server
d) Depends on the usage of the table
View Answer

Answer: b
Explanation: It is not necessary to insert the value in each column because there always a default value is inserted by the server “NULL”.

3. In the following SQL query, what does “person” stands for?

advertisement
advertisement
    INSERT INTO person
    (person_id, fname, lname) 
    VALUES (1,’S’,’P’);

a) Composite attributes
b) Multivalued attributes
c) Table name
d) None of the mentioned
View Answer

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

4. In the following SQL query, what does “person_id” stands for?

   CREATE TABLE person
   (person_ id SMALLINT UNSIGNED,
   fname VARCHAR(20),
   lname VARCHAR(20),
   CONSTRAINT pk_person PRIMARY KEY (person_id));

a) Normal attribute of the table
b) Super key
c) Composite key
d) Primary key
View Answer

Answer: b
Explanation: Primary key is also termed as a super key.
advertisement

5. Which statement can be used for modifying the definition for an existing table?
a) ALTER
b) Modified
c) SELECT
d) FROM
View Answer

Answer: a
Explanation: None.
advertisement

6. Which feature is used for the automatic increment of the column?
a) AUTO_INCREMENT
b) AUTO
c) INCREMENT
d) All of the mentioned
View Answer

Answer: a
Explanation: None.

7. Which among the following is the correct syntax for modifying the definition of an existing table?
a) ALTER TABLE person MODIFY person_id SMALLINT UNSIGNED AUTO_INCREMENT;
b) ALTER TABLE person person_id SMALLINT UNSIGNED AUTO_INCREMENT;
c) ALTER TABLE person MODIFY person_id ;
d) ALTER TABLE person
View Answer

Answer: a
Explanation: None.

8. Will the following SQL command produce any error?

  INSERT INTO person
  (person_id, fname,lname)
  VALUES (1,’S’,’U’),
  VALUES (1,’T’,’U’);
 /* where person_id is a primary key */

a) Error
b) No Error
c) Depends
d) None of the mentioned
View Answer

Answer: a
Explanation: Person_id declared as a primary key therefore it never contain same value.

9. Will the following SQL command produce any error?

INSERT INTO person
(person_id, fname,lname)
VALUES (1,’S’,’U’),
VALUES (2,’T’,’U’);
/* where person_id is a primary key */

a) Error
b) No Error
c) Depends
d) None of the mentioned
View Answer

Answer: b
Explanation: None.

10. What is the default value of column?
a) NULL
b) 0
c) -1
d) Undefined
View Answer

Answer: a
Explanation: When table is defined in Mysql then each column related to table will contain NULL Value as default.

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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.