当前位置:网站首页>MySQL learning diary (II)
MySQL learning diary (II)
2022-07-06 10:12:00 【AP840】
SQL Detailed explanation of connection mode :https://www.cnblogs.com/janneystory/p/5618140.html
MYSQL data type :
integer
tinyint(m) 1 Bytes Range (-128~127)
smallint(m) 2 Bytes Range (-32768~32767)
mediumint(m) 3 Bytes Range (-8388608~8388607)
int(m) 4 Bytes Range (-2147483648~2147483647)
bigint(m) 8 Bytes Range (+-9.22*10 Of 18 Power )
[ notes : Add in front unsigned, Then the maximum value in the range 、 The minimum values are doubled .(m) It refers to the display width in the query result set ]
floating-point
float(m,d) Single precision floating point 8 Bit accuracy (4 byte ) m Total number ,d Decimal places
double(m,d) Double precision floating point 16 Bit accuracy (8 byte ) m Total number ,d Decimal places
Fixed-point number
decimal(m,d) Parameters m<65 It's the total number ,d<30 And d<m It's a decimal place
character string (char,varchar,_text)
char(n) Fixed length , most 255 Characters
varchar(n) Fixed length , most 65535 Characters
tinytext Variable length , most 255 Characters
text Variable length , most 65535 Characters
mediumtext Variable length , most 2 Of 24 Power -1 Characters
longtext Variable length , most 2 Of 32 Power -1 Characters
[ notes :varchar The query speed ratio of text fast ,char The query speed ratio of varchar fast ]
MySQL It will be automatically modified to... Before the non-conforming value is inserted into the table 0!!!!!
Simple use of tables :
NULL : Allow null value
NOT NULL : Null value... Is not allowed , When inserting or updating rows , The column must have a value , When inserting a column without a value , Will return an error
【 notes : Space ““ Not equal to null value 】
DEFAULT : Specify default , Without assigning a value to the column , By default, the system assigns DEFAULT The number after
CREATE TABLE OrderItems
(
order_num INTEGER NOT NULL,
order_item INTEGER NOT NULL,
prod_id CHAR(10) NOT NULL,
quantity INTEGER NOT NULL DEFAULT 1,
item_price DECIMAL(8,2) NOT NULL
);
The assumption is that quantity There is no assignment in a cell , The system assigns values automatically 0;
————————————————————————————————————————————————————
Update table :
ALTER TABLE( surface )
------------------------------
Add a column to the existing table :
alter table Table name add Name data type ;( Such as ,vend_phone)
------------------------------
Delete a known column for the existing table :
alter table Table name drop Name ;
------------------------------
Delete an existing table :
drop table Table name ;
------------------------------
Change the table name of an existing table :
alter table The old name of the table rename to/as The new name of the table ;
------------------------------
Update the existing data in the table :
give an example :
Update a column :
update customers
set cust_email = '[email protected]'
where cust_id = 1000000005;
Update multiple columns :
update customers
set cust_contact = 'Sam Roberts',
cust_email = '[email protected]'
where cust_id = 1000000006;
When you want to delete the value of a column , It can be changed to cust_contact = NULL ,cust_email = NULL
------------------------------
Delete data :
give an example :
delect from customers
where cust_id = 1000000006;
This is intended to delete the table customers in cust_id=1000000006 A row of data , Note that if you delete a specific column , use update sentence ;
If there is no “where cust_id = 1000000006;” Delete customers All rows in , But the form still exists .
边栏推荐
- MySQL Real Time Optimization Master 04 discute de ce qu'est binlog en mettant à jour le processus d'exécution des déclarations dans le moteur de stockage InnoDB.
- C杂讲 双向循环链表
- Use xtrabackup for MySQL database physical backup
- The real future of hardware engineers may not be believed by you if I say so
- Competition vscode Configuration Guide
- Constants and pointers
- cmooc互联网+教育
- The 32 year old programmer left and was admitted by pinduoduo and foreign enterprises. After drying out his annual salary, he sighed: it's hard to choose
- MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
- Installation of pagoda and deployment of flask project
猜你喜欢
13 medical registration system_ [wechat login]
MySQL Real Time Optimization Master 04 discute de ce qu'est binlog en mettant à jour le processus d'exécution des déclarations dans le moteur de stockage InnoDB.
CAPL脚本中关于相对路径/绝对路径操作的几个傻傻分不清的内置函数
在CANoe中通过Panel面板控制Test Module 运行(高级)
C杂讲 文件 初讲
jar运行报错no main manifest attribute
MySQL的存储引擎
13 医疗挂号系统_【 微信登录】
MySQL实战优化高手02 为了执行SQL语句,你知道MySQL用了什么样的架构设计吗?
MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
随机推荐
CANoe仿真功能之自动化序列(Automation Sequences )
Mexican SQL manual injection vulnerability test (mongodb database) problem solution
美新泽西州州长签署七项提高枪支安全的法案
Write your own CPU Chapter 10 - learning notes
Why is 51+ assembly in college SCM class? Why not come directly to STM32
MySQL combat optimization expert 04 uses the execution process of update statements in the InnoDB storage engine to talk about what binlog is?
The appearance is popular. Two JSON visualization tools are recommended for use with swagger. It's really fragrant
14 医疗挂号系统_【阿里云OSS、用户认证与就诊人】
MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?
Redis集群方案应该怎么做?都有哪些方案?
在CANoe中通过Panel面板控制Test Module 运行(高级)
CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
17 medical registration system_ [wechat Payment]
Not registered via @EnableConfigurationProperties, marked(@ConfigurationProperties的使用)
CANoe不能自动识别串口号?那就封装个DLL让它必须行
MySQL实战优化高手05 生产经验:真实生产环境下的数据库机器配置如何规划?
Good blog good material record link
Control the operation of the test module through the panel in canoe (Advanced)
MySQL storage engine
C miscellaneous two-way circular linked list