当前位置:网站首页>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


边栏推荐
- mysql 索引使用与优化
- Go's walk library reports an error
- What are the conditions for zero foundation learning software testing?
- Leetcode79 method 1: deep search
- Msg.value of solidity
- VSC writes go, expected 'package' appears, found 'EOF‘
- Error 2003 (HY000) can't connect to MySQL server on 'localhost3306' (10061) solution
- MQTT over QUIC:下一代物联网标准协议为消息传输场景注入新动力
- 深圳线下报名|StarRocks on AWS:如何对实时数仓进行极速统一分析
- MYSQL入门与进阶(十)
猜你喜欢

Introduction to advanced design system (ads) 2009 RF simulation

1.2、队列

Brief introduction: basic principle of srv6

冒泡排序和相关视频

Go并发详解之一

Apple develops a complete creation process of Apple certificate and description file

MySQL advanced mvcc (ultra detailed collation)

Noise of creative coding

USB type-C details

欧美六国最快5日达 菜鸟推出快线产品 优化“端到端”履约服务
随机推荐
UE5 GAS 学习笔记 1.1能力系统组件Ability System Component
UE5 GAS 学习笔记8.0参考资料
Log base zap of go language series
Multithreading and high concurrency -- source code analysis AQS principle
Implementation of solid transfer function (based on transfer)
Ue5 gas learning notes 1.1 capability system component
MySQL operation Encyclopedia
MySQL index usage and optimization
Ue5 gas learning notes 1.6 skills gameplay ability
iptables防火墙端口规则配置
Is it really realistic that people who have not been exposed to software testing can take up their posts after two months of training?
冒泡排序和相关视频
Cout.write learning
ERROR 2003 (HY000) Can‘t connect to MySQL server on ‘localhost3306‘ (10061)解决办法
高德地图实现自定义小蓝点 自定义点标记 绘制多边形/圆形区域 根据地图的移动显示或者隐藏自定义点标记的相关实现
UE5 GAS 学习笔记 1.2游戏标签
Devops in digital transformation -- flexible cooperation
Ue5 gas learning notes 0.2 configuration plug-in
It is said that software testing is the worst in the IT industry. Is that so?
Examples of AC simulation and S-parameter simulation of ADS simulation