GPT答: |
7i24.cn
|
1. 创建学生信息表:
```sql
CREATE TABLE student_info (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
gender VARCHAR(10),
score INT,
age INT
);
```
2. 写入5条不同的数据:
```sql
INSERT INTO student_info (name, gender, score, age) VALUES
('小红', '女', 75, 20),
('小明', '男', 85, 22),
('小华', '男', 65, 21),
('小丽', '女', 90, 23),
('小强', '男' ,55 ,24);
```
3. 查询所有的男生数据(只需要学生的姓名和年龄):
```sql
SELECT name, age FROM student_info WHERE gender = '男';
```
4. 查询及格学生成绩信息(学生成绩大于或等于60分):
```sql
SELECT * FROM student_info WHERE score >=60;
```
5. 按照学生的分数进行排序:
```sql
SELECT * FROM student_info ORDER BY score;
```
6. 将所有女生年龄增加一岁:
```sql
UPDATE student_info SET age = age +1 WHERE gender = '女';
```
|