Niuke — My own wrong questions in MySQL multiple choice exercises (4)

Analysis of wrong questions

1. In a relational database, there are two different transactions operating the same row of the same table in the database at the same time. What will not cause conflict is: F
reason analysis:

  • Because the ultimate purpose of delete is to delete data, no matter which one is deleted first, the result is the same.
    Insert picture description here

2. The SQL for calculating the total score of each student's multi-disciplinary is ____C_
reason analysis:

  • The total score is sum, use sum;
  • Because it’s every student, we have to group; choose C
    Insert picture description here

3. Which of the following is not the communication protocol that interacts with the Mysql server (B)
Reason analysis:
Insert picture description here

4. There are multiple departments and multiple employees in the company, each employee can only belong to one department, and one department can have multiple employees. Then the connection between the entity department and the staff is (C)
Reason analysis:

department Staff
1 A staff member belongs to a department
There are multiple employees in a department n

Therefore, between departments and employees is 1-n (one-to-many)

Insert picture description here

5. There are two transactions T1, T2, the concurrent operations are as follows, the following evaluation is correct is (D)
reason analysis:

  • Because these two transactions are read first, after T1 is modified, T2 does not know at all, so the modification operation of T1 will be lost.
    Insert picture description here

6.The mysql database has a course selection table learn (student_id int, course_id int), and the fields respectively represent the student number and the course number. Now I want to get the information about the number of courses selected by each student. Is the following SQL statement correct? (B)
Reason analysis:

  • Number of messages, use count;
  • Each student is acquired, so it is necessary to group;
    Insert picture description here

7. If transaction T obtains an exclusive lock on data item Q, then T pairs Q_____C_.
Reason analysis:

  • Exclusive locks are also called exclusive or write locks . Once transaction T adds an exclusive lock to data object A, only T is allowed to read and modify A. Any other transaction can neither read or modify A nor add any type of lock to A until T releases A. Until the lock
    Insert picture description here

8. In the relational model, the constraint that "represents the relevant connection between two relations" is achieved through (C)
reason analysis:

  • The master-slave relationship is realized through foreign keys;
    Insert picture description here

9. The student relationship model S (S#, Sname, Sex, Age), the attributes of S respectively represent the student number, name, gender, and age of the student. To delete an attribute "age" in table S, the SQL statement that can be used is (A)
Reason analysis:

  • Because the deleted attribute is an attribute, the alter in the DDL language is used to modify the table structure;
  • Then delete the attribute, using drop;
    Insert picture description here

10. Among the following options, what is not a SQL constraint is the D
reason analysis:

  • unique: guarantee uniqueness;
  • primary key: primary key, non-empty and unique;
  • foreign key: foreign key;
  • D option is just a filter condition;
    Insert picture description here

Guess you like

Origin blog.csdn.net/qq_45665172/article/details/114215812