当前位置:网站首页>Day06 homework - skill question 6
Day06 homework - skill question 6
2022-07-26 08:52:00 【Ning Meng】
1. establish test database
create database test character set utf8;2. stay test Create in the database student surface ,(id Set as primary key self growth )
create table student(
id int primary key auto_increment,
name varchar(20),
score int,
address varchar(50),
useremail varchar(20)
)
desc student;
3. towards student Add records to the table
insert into student value(1,' Zhang San ',98,' Beijing ','[email protected]'),(2,' Li Si ',88,' Shanghai ','[email protected]'),(3,' Wang Wu ',78,' Guangzhou ','[email protected]'),(4,' Zhao Liu ',68,' Shenzhen ','[email protected]'),(5,' Sun Qi ',58,' Hangzhou ','[email protected]'),(6,' Xiaohong ',48,' Beijing ','[email protected]'),(7,' Little black ',99,' Shanghai ','[email protected]'),(8,' Little green ',100,' Hangzhou ','[email protected]'),(9,' Small powder ',60,' Hangzhou ','[email protected]'),(10,' Lilac ',70,' heilongjiang ','[email protected]')4. Use sql Statement to query the table id,name, and address All the contents of the field
select id,name,address from student;
5. Use sql Statement to query all students in the table id,name,score
select id,name,score from student;

6. change useremail The data type of the field is varchar(50)
alter table student modify column useremail varchar(50);
desc student;
7. Add a field to the table , The field name is “pingjia”, Field type is varchar(20)
alter table student add pingjia varchar(20);
desc student;
8. Change the score of the classmate whose name is Zhang San to 92
update student set score=92 where name=' Zhang San ';
select * from student; 
9. If 80 It's a passing line , Find out the details of all the students who failed
select * from student where score <80; 
10. Name is “ Xiaohong ” Students' scores are on the original basis +20
update student set score=score+20 where name=' Xiaohong ';
select * from student; 
11. Use keywords in, Inquire about id The value is 1 or 5 or 7 Basic information of students
select * from student where id in(1,5,7);
12. Inquire about id Values in 4 to 9 Basic information of all students
select * from student where id between 4 and 9;
13. The query name is Xiaohong and the score is greater than 60 Basic information of students
select * from student where name=' Xiaohong ' or score>60; 
14. The query name is Xiao Hong or the score is greater than 90 Basic information of students
select * from student where name=' Xiaohong ' or score>90;
15. Inquire about score The field value is NULL Basic information of students
select * from student where score is null;
16. Inquire about name Not Zhang San's classmate id,name, and score
select id,name,score from student where not name=' Zhang San ';
17. Ascending by address , The grades are in descending order
select * from student order by address,score desc;
18. De duplicate the city
select distinct address from student; 
边栏推荐
- SSH,NFS,FTP
- Grid segmentation
- Oracle 19C OCP 1z0-082 certification examination question bank (7-12)
- Using the primitive root of module m to judge and solve
- Arbitrum launched the anytrust chain to meet the diverse needs of ecological projects
- Learning notes of automatic control principle --- linear discrete system
- Oracle 19C OCP 1z0-082 certification examination question bank (24-29)
- P3743 Kotori's equipment
- Set of pl/sql
- 合工大苍穹战队视觉组培训Day6——传统视觉,图像处理
猜你喜欢

数据库操作 题目二
![[freeswitch development practice] user defined module creation and use](/img/5f/3034577e3e2bc018d0f272359af502.png)
[freeswitch development practice] user defined module creation and use

海内外媒体宣发自媒体发稿要严格把握内容关

Huffman transformation software based on C language

Human computer interaction software based on C language

Winter vacation homework & Stamp cutting

pl/sql之动态sql与异常

Spark scheduling analysis

OA项目之我的会议(查询)

Hegong sky team vision training Day6 - traditional vision, image processing
随机推荐
Solve the problem of C # calling form controls across threads
[untitled]
【FreeSwitch开发实践】自定义模块创建与使用
Cve-2021-3156 duplicate of sudo heap overflow privilege raising vulnerability
The lessons of 2000. Web3 = the third industrial revolution?
Excel delete blank lines
Alphabetic string
Foundry教程:使用多种方式编写可升级的智能合约(上)
day06 作业--技能题1
[recommended collection] MySQL 30000 word essence summary index (II) [easy to understand]
Self review ideas of probability theory
CSDN TOP1“一个处女座的程序猿“如何通过写作成为百万粉丝博主?
ES6模块化导入导出)(实现页面嵌套)
Ueditot_ JSP SSRF vulnerability recurrence
OA项目之我的会议(查询)
Study notes of automatic control principle -- dynamic model of feedback control system
Excel find duplicate lines
Mysql database connection / query index and other common syntax
pl/sql之集合-2
idea快捷键 alt实现整列操作