I had nothing to worry about. I found an exercise to write at work. The contact question is for mysql below SQL server 2000.
One-word explanation (2 points/time) 34 points
Data Database RDBMS Relational Database Management System GRANT authorization
REVOKE cancel permission DENY permission DECLARE define variable PROCEDURE Stored PROCEDURE
Transaction TRIGGER continues to continue unique unqiue
Primary key identity column identity foreign key check
Constraint
--------------------------------------------------------------------
1) create a student table that contains the following information: Student ID, name, age, gender, home address, and contact number.
Create table student
(
Student ID int,
Name varchar (10 ),
Age int,
Gender varchar (4 ),
Home address varchar (50 ),
Contact number varchar (11)
);
--------------------------------------------------------------------
2) modify the structure of the student table, add a column of Information, education level
Alter table student add column education level varchar (6 );
--------------------------------------------------------------------
3) modify the structure of the student table, delete a column of information, home address
Alter table student drop column home address; // note that drop instead of delete is used here.
--------------------------------------------------------------------
4) Add the following information to the student table:
Student ID name age gender contact phone number Education
1A22 male 123456 Primary School
2B21 male 119 Middle School
3C23 male 110 High School
4D18 female 114 University
Insert into student (student ID, name, age, gender, contact number, education) values (1, "A", 22, "male", "123456", "primary ");
Insert into student (student ID, name, age, gender, contact number, education) values (1, "B", 21, "male", "119", "Middle School ");
Insert into student (student ID, name, age, gender, contact number, education) values (1, "C", 23, "male", "123456", "High School ");
Insert into student (student ID, name, age, gender, contact number, education) values (1, "D", 23, "female", "114", "");
--------------------------------------------------------------------
5) modify the data in the student table and change the educational background of the student whose phone number starts with 11 to "Junior College"
Update student set education level = "" where contact number like "11% ";
--------------------------------------------------------------------
6) Delete the data in the student table, whose name starts with "C" and whose gender is "male ".
Delete from student where name like "C" and Gender = "male ";
--------------------------------------------------------------------
7) query the data in the student table and display the names and student IDs of all students younger than 22 years old with a "junior college degree ".
Select name, student ID from student where age <22 and education level = "Junior College ";
--------------------------------------------------------------------
8) query the data in the student table, query all information, and list the first 25% records.
Select top 25 percent * from student ;????
Select * from student limit 25% ;????
This is a problem. In SQL 2000, it should be select top 25 percent * from student;
--------------------------------------------------------------------
9) query the names, gender, and age of all students in descending order.
Select name, gender, age from student order by age desc;
--------------------------------------------------------------------
10) query all average ages by Gender Group
Select avg (AGE) as average age from student group by gender;
Select avg (AGE) from student group by gender;
Select avg (AGE) average age from student group by gender;
--------------------------------------------------------------------
3) indicate the meanings of the following Aggregation numbers: avg, sum, max, min, count, count (*)
AVG: Average Value
SUM: SUM
MAX: calculates the maximum value.
MIN: Minimum value
COUNT (*): returns all rows.
COUNT returns the record value that meets the specified condition.