当前位置:网站首页>Fundamentals of SQL database operation
Fundamentals of SQL database operation
2022-07-04 06:32:00 【supermeatboy223】
MySQL Basic operation
1. Connect to database
Enter the command :
mysql -u root -p
After that Enter password Enter the database password 
2. Display all database names in the system
Enter the command : show databases;
Be careful : most SQL Command to ; End of character .
3. New database student
Enter the command :
create database student ;
Again using show databases; Look at the results .
4. Using a database student
command :
use student;
5. In the database student Create a table result
command : create table result (id int(8),name varchar(20),city varchar(20),score int(5));
6. In the table result Add data to
stay result Insert data
command :
insert into result(id,name,city,score) values(1,"wang","beijing",75);
Be careful When defining the form, you define the type for each data among id , score by int Integer type When adding data, increase the integer
name,city Defined characters char so When adding data increase "wang" "bengjing" Put in quotation marks .
Repeat adding data similar to the above command .
After successful insertion Use select * from result; see result Everything in the table . 
7. In the table result Delete in 1 Data
for example , Delete name = "han" This data of .
delete from result where name = "han";
After deleting successfully see select * from result;.
8. Modify table result Data in the
for example , modify name = "zhou" The data of , Put it id Set to 4.
update result set id=4 where name ="zhou" ;
View results

9. Query table result Data in
for example :
select * from result ; // Query all fields in the table
select name,score,cty from result ; // In the query table name,score,city Field .

select score from result where name ="li"; // Inquire about name by li Of the students score.
The second part :MYSQL Advanced operation
1.order by Usage of
(1) take result The data in the table is ranked from high to low ;
select * from result order by score desc; // among ,desc Representation of descending order ,asc Expressing ascending order , If no parameter is added here, the default sorting is in ascending order .


边栏推荐
- 746. Climb stairs with minimum cost
- Option (024) - do all objects have prototypes?
- Sword finger offer II 038 Daily temperature
- C语言中的函数(详解)
- 测试岗的中年危机该如何选择?是坚守还是另寻出路?且看下文
- Leetcode question brushing record | 206_ Reverse linked list
- Detectron: train your own data set -- convert your own data format to coco format
- Distributed cap theory
- R统计绘图-随机森林分类分析及物种丰度差异检验组合图
- 运算符<< >>傻瓜式测试用例
猜你喜欢

Overview of convolutional neural network structure optimization

Uninstall Google drive hard drive - you must exit the program to uninstall

what the fuck! If you can't grab it, write it yourself. Use code to realize a Bing Dwen Dwen. It's so beautiful ~!

High performance parallel programming and optimization | lesson 02 homework at home

C réaliser des jeux de serpents gourmands

Notes and notes

740. Delete and get points

LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout

AWT介绍

Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
随机推荐
AWT常用组件、FileDialog文件选择框
QT 获取随机颜色值设置label背景色 代码
树形dp
How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?
Layoutmanager layout manager: flowlayout, borderlayout, GridLayout, gridbaglayout, CardLayout, BoxLayout
Considerations for testing a website
Error CVC complex type 2.4. a: Invalid content beginning with element 'base extension' was found. Should start with one of '{layoutlib}'.
24 magicaccessorimpl can access the debugging of all methods
P26-P34 third_ template
How to solve the component conflicts caused by scrollbars in GridView
Distributed cap theory
2022.7.3-----leetcode.556
Weekly summary (*63): about positive energy
《ClickHouse原理解析与应用实践》读书笔记(4)
How to help others effectively
云原生——上云必读之SSH篇(常用于远程登录云服务器)
C实现贪吃蛇小游戏
Component、Container容器常用API详解:Frame、Panel、ScrollPane
QT qtablewidget table column top requirements ideas and codes
8. Factory method


