MYSQL MCQ and Answers – Part 5
MYSQL MCQs questions with answers to prepare for exams, tests, and certifications. These questions are taken from a real written exam and some parts are taken from an interview. So you will find questions on MySQL Database, SQL query, Data Model, and more. This MCQ will easily prepare anyone to pass their exam.
1. Which of the following command is used to drop an existing table?
A DROP TABLE
B DELETE
C Both A and B
D None of the above
2. Which of the following command is used to display all existing tables in a database?
A SHOW TABLES
B SHOW TABLE
C SHOW
D None of the above
3. Is duplicate primary key allowed in SQL?
A Yes
B No
C Depends on DBMS
D None of the above
4. Is duplication of attributes allowed in SQL?
A Yes
B No
C Depends on DBMS
D None of the above
5. What is the correct format for storing date in SQL?
A DEC-01-1994
B 08-1994-12
C 08-DEC-16
D 1994-12-08
6. Which of following the following statement will produce an error?
A SELECT * FROM person WHERE person_id=1;
B SELECT lastname FROM person;
C SELECT lastname, firstname, person_id FROM person;
D None of the above
7. What key is used to link two tables in Mysql?
A Primary key
B Foreign key
C Primary and foreign key
D None of the above
8. Find the error?
CREATE TABLE person ( person_id SMALLINT, lastname VARCHAR, FIRSTNAME VARCHAR, birth_date DATE CONSTRAINTS pk_person PRIMARY KEY (person_id) ); INSERT INTO personne( person_id, lastname, FIRSTNAME, Birth_date ) VALUES(1,’a’,’b’, 09-1994-02);
A Error in data values
B No Error
C Other error
D None of the above
9. Find the error?
CREATE TABLE person ( person_id SMALLINT, lastname VARCHAR, FIRSTNAME VARCHAR, birth_date DATE CONSTRAINTS pk_person PRIMARY KEY (person_id) ); INSERT INTO person( person_id, lastname, FIRSTNAME) VALUES(1, ’a’, ’b’); INSERT INTO person( person_id, lastname, FIRSTNAME) VALUES(1,’c’,’d’);
A No Error
B Error, duplicate value
C Other error
D None of the above
10. What are the valid data types in Mysql?
A Numeric
B Temporary
C Text
D All the answers are true