当前位置:网站首页>Introduction and advanced level of MySQL (5)
Introduction and advanced level of MySQL (5)
2022-07-28 18:43:00 【Xiaoxinai programming】
Here's the catalog title
- 1、Navicat in SQL How to write it
- 2、 frequently-used SQL
- 2.1、 Query which databases are
- 2.2、 Create a new database
- 2.3、 Using a database
- 2.4、 Check which database tables are in the database
- 2.5、 Create database tables
- 2.6、 View table structure
- 2.7、 Add data ------ DML operation
- 2.8、 The entire contents of the query table ------ DQL
- 2.9、 Modify the statement ------ DML
- 2.10、 Delete statements
- 2.11、 Delete table Delete library run
1、Navicat in SQL How to write it
① It is recommended to use after proficiency 
② Use black window
Tools 
There is a command line interface

2、 frequently-used SQL
2.1、 Query which databases are


Be careful : A semicolon yes We SQL Finished mark , Do not belong to SQL The content of . In the future, we java I just need to write SQL that will do You don't need to write a semicolon .
2.2、 Create a new database
When we write the project You need to start with creating a database
create database Database name 
2.3、 Using a database
We are now Created a database called mytest, We need to be early mytest Create a new database table in . At this time, if you need to mytest Operation in The first thing you need to To indicate which database to use
( use Database name )
here Let's operate again Is in the mytest The operation under the database .
Be careful :

stay near After the word is us sql What went wrong , But not necessarily It could be front or back
2.4、 Check which database tables are in the database

Prove that there are no database tables in this database Empty set
2.5、 Create database tables

grammar :
( Relational database uses tables to store data , The table is divided into rows and columns , The parentheses behind the table are the columns that customize the current table )
create table Table name (
Name data type [ constraint ] ,
Name data type [ constraint ]
Name data type [ constraint ]
Name data type [ constraint ]
Name data type [ constraint ]
…
)
Be careful : constraint
primary key Primary key
auto_increment Auto increment
data type
int integer
varchar(20) The string type is equivalent to java Medium String 20 Represents the length Be careful Be sure to have length
2.6、 View table structure
desc Table name 
2.7、 Add data ------ DML operation
Add a row
① Add a row of data to the specified column 
representative Go to student Add a row of data to the table also name The column is Zhang San age yes 18 address It's Beijing. 


Be careful here We didn't add id Value of class id It's worth it The reason lies in id When we create this column, we set Auto increment , When we add data Even if no value is specified It will also be added automatically .
③ If there are many columns Want to add it all At this time, you can not specify columns 

④ One insert Add multiple rows of data

2.8、 The entire contents of the query table ------ DQL

2.9、 Modify the statement ------ DML
update Table name set Name = value 

Be careful without where Conditional statement At this time, it means that the whole table is modified
You can also change multiple columns of data 
And support operations
for example Add the age of everyone to the original basis 3 year 
2.10、 Delete statements


2.11、 Delete table Delete library run


边栏推荐
- Go exe generates icon version information
- Zen project management software is an indispensable tool for agile development teams
- 记录自己在厦门两年来的面试经历--完结篇
- @Autowired与@Resource区别
- mysql 索引使用与优化
- How does Xiaobai learn software testing with zero foundation?
- Mingde biology: no products of the company have been listed in the WHO recommended list
- Meta Q2财报:营收首次下滑,Metaverse将与苹果竞争
- 当Golang遇到高并发秒杀
- Shenzhen offline registration starrocks on AWS: how to conduct rapid unified analysis of real-time data warehouses
猜你喜欢

npm 无法将“npm”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。

MYSQL入门与进阶(十)

Record your interview experience in Xiamen for two years -- Conclusion

When golang encounters high concurrency seckill

UE5 GAS 学习笔记0.2配置插件

深圳线下报名|StarRocks on AWS:如何对实时数仓进行极速统一分析

#夏日挑战赛#【FFH】JS自定义组件:DIY一个随点随用的键盘!(一)

MQTT over QUIC:下一代物联网标准协议为消息传输场景注入新动力

连线:谁拥有未来的艺术?OpenAI允许Dall-E用户将作品商用化,目前而言

.net WCF WF4.5 状态机、书签与持久化
随机推荐
Principle, classification and requirements of antenna
顿悟!百度强推的Redis天花板笔记,原来数据库是这样理解的
Ue5 gas learning notes 1.1 capability system component
欧美六国最快5日达 菜鸟推出快线产品 优化“端到端”履约服务
Summer Challenge [FFH] JS custom component: DIY a keyboard that can be used at any time! (I)
从 SRE 看 DevOps 建设
DC-DC switching power supply
Novice record: some small knowledge of mechanical keyboard
NDK 系列(5):JNI 从入门到实践,爆肝万字详解!
多线程与高并发—— 源码解析 AQS 原理
一文简述:SRv6基本原理
Ue5 gas learning notes 0.1 case Preview
DC simulation example of ADS simulation
明德生物:公司暂未有产品被列入WHO推荐清单
直播|StarRocks 技术内幕 :低基数全局字典优化
Detailed explanation of network RJ45 interface
Modifier modifier modifier of solidity _;
1.3、链表
UE5 GAS 学习笔记0.1 案例预览
Shenzhen offline registration starrocks on AWS: how to conduct rapid unified analysis of real-time data warehouses