写出下列操作的SQL语句。 (1)向表中插入一行,学号:19110611103、姓名:李欣、年龄:22、专业:电子信息工程、性别:女、密码:123456; (2 )向表中插入一行,学号:19110611102、 姓名:张辉、 年龄:22; (3)将学号为19110611102的姓名修改为张辉瓒; (4)将所有男学生的年龄加1、密码修改为jsj2022; (5)删除学号为19110611102的学生记录; (6)删除计算机专业中的所有女生记录。
时间: 2024-01-18 14:04:36 浏览: 108
(1)向表中插入一行,学号:19110611103、姓名:李欣、年龄:22、专业:电子信息工程、性别:女、密码:123456:
```sql
INSERT INTO students (student_id, name, age, major, gender, password) VALUES ('19110611103', '李欣', 22, '电子信息工程', '女', '123456');
```
(2)向表中插入一行,学号:19110611102、 姓名:张辉、 年龄:22:
```sql
INSERT INTO students (student_id, name, age) VALUES ('19110611102', '张辉', 22);
```
(3)将学号为19110611102的姓名修改为张辉瓒:
```sql
UPDATE students SET name = '张辉瓒' WHERE student_id = '19110611102';
```
(4)将所有男学生的年龄加1、密码修改为jsj2022:
```sql
UPDATE students SET age = age + 1, password = 'jsj2022' WHERE gender = '男';
```
(5)删除学号为19110611102的学生记录:
```sql
DELETE FROM students WHERE student_id = '19110611102';
```
(6)删除计算机专业中的所有女生记录:
```sql
DELETE FROM students WHERE major = '计算机专业' AND gender = '女';
```
阅读全文