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

Analysis of wrong questions

1. Given the data table score(stu-id,name,math,english,Chinese), which of the following statements is correct is (A)
Reason analysis:

  • B is wrong, * is multiple lines, sum is not
  • C the same reason
  • The delete from table name in the correct format in D;
  • A is actually wrong, the case of column name c;
    Insert picture description here

2. SQL Server 2005 belongs to (D)
reason analysis:

  • SQL Server 2005 is a relational database management system launched by Microsoft.
    Insert picture description here

3. There is a table tb1 in a database mydb, there are six fields in the table, the primary key is ID, there are ten records, the ID is from 0 to 9, the following code output result is (C)
Reason analysis:

  • mysql_num_fields: The number of fields (id, name, age) in the returned result set is 3 fields;
    Insert picture description here

4. In a mysql query, which keyword can be used to remove duplicate column values ​​(C)
Reason analysis:

  • Group A
  • B sort
  • C deduplication
  • D page
    Insert picture description here

5. In a query sql containing group by, both having and where exist. When sql is parsed and executed, which one is executed first? B
reason analysis:

  • where is before, having is after;
    Insert picture description here

6. How many tables are involved at least when the database is doing a join operation? B
reason analysis:

  • At least one table, inner join
    Insert picture description here

7. In the following two relations, the employee number and department number are the primary key (or master code) of the employee relationship and the department relationship, respectively. Employee (employee number, employee name, department number, position, salary) department (department number, Department name, number of people in department, total salary) Among the attributes of these two relationships, only one attribute is a foreign key (or foreign key, foreign code, foreign code), which is B
reason analysis:

  • The foreign key must be the primary key in another table;
    Insert picture description here

8. Which of the following commands is the
reason for deleting the tb_ame table (D) of the sample database :

  • drop is to delete the table;
  • delete is to delete the data in the table;
    Insert picture description here

9. The return value of the statement SELECT IF(-1,5,2) is: D
Reason analysis:

  • IF (condition, expression 1, expression 2)
  • The condition is 0 is false, and expression 2 is executed;
  • As long as the condition is not 0, it is true, and expression 1 is executed;
  • -1 is not equal to 0, it is true;
    Insert picture description here

10. There are three tables: student table S, course table C and student elective table SC in the database. Their structure is as follows: S (S#, SN, SEX, AGE, DEPT) C (C#, CN) SC (S#, C#, GRADE) where: S# is the student number, SN is the name, SEX is the gender, AGE is the age, DEPT is the department, C# is the course number, CN is the course name, and GRADE is the grade. Please search for the student number with the highest score among the students whose elective course number is C2. (D)
Reason analysis:

  • As long as the student number directly excludes A
  • Use ALL for the highest score, >= means greater than or equal to the maximum value behind ALL;
  • If it is less than it is less than the minimum value after ALL;
    Insert picture description here

Guess you like

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