当前位置:网站首页>day06 作业--技能题1
day06 作业--技能题1
2022-07-26 08:41:00 【宁氓】
1.创建test数据库
create database test character set utf8;2.在test数据库中创建student表,(id设置为主键自增长)
create table student(
id int primary key auto_increment,
name varchar(20),
score int,
address varchar(50),
useremail varchar(20)
)
desc student;
3.向student表中添加记录
insert into student value(1,'张三',98,'北京','[email protected]'),(2,'李四',88,'上海','[email protected]'),(3,'王五',78,'广州','[email protected]'),(4,'赵六',68,'深圳','[email protected]'),(5,'孙七',58,'杭州','[email protected]'),(6,'小红',48,'北京','[email protected]'),(7,'小黑',99,'上海','[email protected]'),(8,'小绿',100,'杭州','[email protected]'),(9,'小粉',60,'杭州','[email protected]'),(10,'小紫',70,'黑龙江','[email protected]')4. 使用sql语句查询出表中的所有内容
SELECT * from student;
5. 使用sql语句查询出表中所有score>70的同学的id,name,score
select id,name,score from student where score>70;

6.更改name字段的数据类型为varchar(50)
alter table student MODIFY COLUMN name varchar(50);
desc student;
7.向表中添加一个字段,字段名称为“pingjia”,字段类型为varchar(20)
alter table student add pingjia varchar(20);
desc student;
8.更改姓名是张三的同学的分数为88
update student set score=88 where name='张三';
select * from student; 
9.如果80分为及格线,查询出所有及格的同学的详细信息
select * from student where score >=80; 
10.使用关键字in,查询id值是1或5或7的同学的基本信息
select * from student where id in(1,5,7); 
11.查询id值在5至8的所有同学的基本信息
select * from student where id between 5 and 8;
12.查询姓名是小红并且分数大于60的同学的基本信息
select * from student where name='小红' and score>60;
13.查询姓名是小红或者分数大于90的同学的基本信息
select * from student where name='小红' or score>90; 
边栏推荐
- SSH,NFS,FTP
- [encryption weekly] has the encryption market recovered? The cold winter still hasn't thawed out. Take stock of the major events that occurred in the encryption market last week
- 【加密周报】加密市场有所回温?寒冬仍未解冻 盘点上周加密市场发生的重大事件
- TypeScript版Snowflake主键生成器
- The effective condition of MySQL joint index and the invalid condition of index
- Which financial product has the highest yield in 2022?
- Implementation of Prometheus web authentication and alarm
- Oracle 19C OCP certification examination software list
- File management file system based on C #
- Oracle 19C OCP 1z0-083 question bank (7-12)
猜你喜欢

day06 作业--技能题6

基于C语言的内存管理-动态分区分配方式模拟

Mysql8 dual master and dual slave +mycat2 read / write separation

tcp 解决short write问题

Excel find duplicate lines

23.6 23.7 web environment web environment variable reading

Spark persistence strategy_ Cache optimization

Registration of finite element learning knowledge points

Xshell batch send command to multiple sessions

keepalived双机热备
随机推荐
Maximum common substring & regularity problem
Spark scheduling analysis
Typescript encryption tool passwordencoder
MySQL 8.0 OCP 1z0-908 certification examination question bank 1
23.6 23.7 web environment web environment variable reading
23.2 customizing the banner control display hidden banner modify banner
Hegong sky team vision training Day6 - traditional vision, image processing
Mycat2 deploy master-slave MariaDB
[untitled]
P1825 [USACO11OPEN]Corn Maze S
Use index to optimize SQL query "suggestions collection"
Cve-2021-26295 Apache OFBiz deserialization Remote Code Execution Vulnerability recurrence
Flutter custom player progress bar
Dear teachers, how can sqlserver get DDL in flinkcdc?
Vision Group Training Day5 - machine learning, image recognition project
23.8 using the applicationrunner or commandlinerunner to implement applicationrunner and commandlinerunner
[recommended collection] MySQL 30000 word essence summary + 100 interview questions (I)
有限元学习知识点备案
SSH,NFS,FTP
Inaccurate problem of flutter fijkplayer seekto