当前位置:网站首页>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 .
边栏推荐
- ADC voltage calculation of STM32 single chip microcomputer
- Grounding relay dd-1/60
- Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?
- 树形dp
- Tf/pytorch/cafe-cv/nlp/ audio - practical demonstration of full ecosystem CPU deployment - Intel openvino tool suite course summary (Part 2)
- C réaliser des jeux de serpents gourmands
- webrtc 快速搭建 视频通话 视频会议
- 如何实现视频平台会员多账号登录
- 金盾视频播放器拦截的软件关键词和进程信息
- Overview of convolutional neural network structure optimization
猜你喜欢
测试岗的中年危机该如何选择?是坚守还是另寻出路?且看下文
剑指 Offer II 038. 每日温度
MySQL learning notes 3 - JDBC
Leetcode question brushing record | 206_ Reverse linked list
Learning multi-level structural information for small organ segmentation
C réaliser des jeux de serpents gourmands
AWT introduction
HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)
Tf/pytorch/cafe-cv/nlp/ audio - practical demonstration of full ecosystem CPU deployment - Intel openvino tool suite course summary (Part 2)
Leakage detection relay jy82-2p
随机推荐
C语言中的排序,实现从小到大的数字排序法
Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
Win10 clear quick access - leave no trace
对List进行排序工具类,可以对字符串排序
Option (024) - do all objects have prototypes?
The solution of win11 taskbar right click without Task Manager - add win11 taskbar right click function
Internet of things protocol ZigBee ZigBee module uses the concept of protocol stack
Sort list tool class, which can sort strings
1、 Relevant theories and tools of network security penetration testing
Json Web token - jwt vs. Traditional session login Authentication
How to avoid JVM memory leakage?
Another company raised the price of SAIC Roewe new energy products from March 1
Appium foundation - appium installation (II)
Realize IIC data / instruction interaction with micro batg135
Yiwen unlocks Huawei's new cloud skills - the whole process of aiot development [device access - ESP end-to-side data collection [mqtt]- real time data analysis] (step-by-step screenshot is more detai
微信小程序使用rich-text中图片宽度超出问题
Vant --- detailed explanation and use of list component in vant
70000 words of detailed explanation of the whole process of pad openvino [CPU] - from environment configuration to model deployment
Appium基础 — APPium安装(二)
ES6 模块化