Job Recruitment Website - Property management company - Problems with SQL

Problems with SQL

Brother, let's help you with your homework. Learn this by yourself when you have time. Let me help you do it first.

Fill in the blanks:

1。 Insert a new record in the class table (04, 10 Property Management)

Insert into class table value ('04' 04', 10 property management)

2. Query the names of all students in 09 software development class.

Select students' names from the class table.

Where the category number is in (select the category number from the category table, where the category name = "09 Software Development").

Functional analysis questions:

Say the function of the following SQL statement.

1. Delete from students, where name =' Zhang San'

Delete the record named Zhang San

2 Choose from the students *

In which age =22 years old.

Sort by name, dese

Find out the records of all 22-year-old students, and arrange them in descending order by name.

3。 Renew students

Set position =' literary and art committee member'

Where name =' Li Ming'

Update the record of student table Li Ming, and change the position to literary and art committee member.

4. Change students' desks

Add native varchar(20)null

Modify the student table and add the field birthplace, which is varchar(20) and can be empty.

Write corresponding SQL statements to complete the following functions

1. Query the relevant information of all Li students in the student table.

Select * from Student table, where the name is "Li%"

2. Add a primary key constraint "student number" to the student table.

Add constraint primary key _aaa primary key (student number)

3 Increase the age of all students under the age of 20 in the student list 1.

Update student table collection age = age+1 where age

4. Add a field "Gender" to the student table, with data type of char(2), which can be empty.

Change the students' desks

Add gender varchar(2)null.

5 Statistics of students under the age of 20

Select count( 1) from the student table, where age

6. Count the total number of classes with class number 0 1.

Select count( 1) from the student table, where ClassNo='0 1'

7 query the average age of all students in the student table.

Select the average age from the student table.

8. Query the total number of accounting classes

Select count( 1) from the student table, where Class =' Accounting Class'.

Statistics 09 software development class all students over 20 years old.

Select count( 1) from the student table, where class =' 09 software development class' and age >;; 20