当前位置:网站首页>Mysql database foundation
Mysql database foundation
2022-06-26 03:28:00 【Acquaintance-】
List of articles
MySQL Database foundation
1. Operating the database
1.1 Displays all current databases
show databases

1.2 Create database
create database Library name

1.3 Using a database
use database

1.4 Delete database
drop database Library name

2. Common data types
2.1 value type
It can be divided into integer type and floating point type
| data type | size | explain | Corresponding java The type of |
|---|---|---|---|
| bit[(M)] | M The specified number of digits is one by default | Binary system ,M Range from 1 To 64, The storage range is 0 To 2^M-1 | Commonly used Boolean Corresponding bit, The default is 1 position , That is, it can only be saved 0 or 1 |
| tinyint | 1 byte | Byte | |
| smallint | 2 byte | Short | |
| int | 4 byte | Integer | |
| bigint | 8 byte | Long | |
| float(M,D) | 4 byte | Single precision ,M Length ,D Specify the minimum number of digits . Loss of accuracy will occur | Float |
| double(M,D) | 8 byte | Double | |
| decimal(M,D) | M/D Maximum +2 | Double precision ,M Specify the length ,D It means the number of decimal places . Exact value | BigDecimal |
| numeric(M,D) | M/D Maximum +2 | and decimal equally | BigDecimal |
2.2 String type
| data type | size | explain | Corresponding java The type of |
|---|---|---|---|
| varchar(size) | 0-65535 byte | Variable length string | String |
| text | 0-65535 byte | Long text data | String |
| mediumtext | 0-16 777 215 byte | Medium long text data | String |
| blob | 0-65535 byte | Long text data in binary form | byte[] |
2.3 The date type
| data type | size | explain | Corresponding java The type of |
|---|---|---|---|
| datetime | 8 byte | Range from 1000 To 9999 year , No time zone retrieval and conversion . | java.util.Date java.sql.Timestamp |
| timestamp | 4 byte | Range from 1970 To 2038 year , Automatically retrieve the current time zone and convert it . | java.util.Date java.sql.Timestamp |
3. The operation of the table
When using tables, you must first select the database
ues database Library name
3.1 View all tables
show tables
3.2 View table structure
desc Table name
3.3 Create table
create table Table name ( Built in attribute name Data storage mode , Built in attribute name Data storage mode . . . . . .)
3.4 Delete table
drop table Table name
Be careful !!!
The above mentioned deletion operation must be used with caution !!!
Because once deleted , Can't recover , Unless backed up in advance !!!
边栏推荐
- 显卡、GPU、CPU、CUDA、显存、RTX/GTX及查看方式
- Drag and drop
- Using meta analysis to drive the development of educational robot
- 【QT】自定义控件-空气质量仪表盘
- 分割、柱子、list
- Is it safe to open an account in flush online? How to open a brokerage account online
- Upload file / text / picture, box shadow
- 【论文笔记】Deep Reinforcement Learning Control of Hand-Eye Coordination with a Software Retina
- 经典模型——ResNet
- stm32Cubemx:看门狗------独立看门狗和窗口看门狗
猜你喜欢

Clion项目中运行多个main函数

少儿编程对国内传统学科的推进作用

【论文笔记】Manufacturing Control in Job Shop Environments with Reinforcement Learning

UE5全局光照系统Lumen解析与优化

MySQL增删查改(初阶)

Network PXE starts winpe and supports UEFI and legacy boot

Add an "open search description" to the site to adapt to the browser's "site search"“

MySQL development environment

用元分析法驱动教育机器人的发展

Problems encountered in project deployment - production environment
随机推荐
js array数组json去重
Graphics card, GPU, CPU, CUDA, video memory, rtx/gtx and viewing mode
Inkscape如何将png图片转换为svg图片并且不失真
Lumen Analysis and Optimization of ue5 global Lighting System
Scratch returns 400
丝网印刷的种类及其应用方法
使用IDEA画结构图
Stm32cubemx: watchdog ------ independent watchdog and window watchdog
360 秒了解 SmartX 超融合基础设施
Qixia fire department carries out fire safety training on construction site
计组笔记——CPU的指令流水
Insect structure and Deconstruction
工作室第3次HarmonyOS培训笔记
Interpreting Oracle
给网站添加“开放搜索描述“以适配浏览器的“站点搜索“
Group note data representation and operation check code
Click event
Is it safe for individuals to buy stocks with flush software? How to buy stocks
拖放
Various errors in kitti2bag installation



