当前位置:网站首页>Basic SQL statement - insert
Basic SQL statement - insert
2022-06-10 23:15:00 【InfoQ】
increase (insert)
insert Use standard
insert Code samples
-- Create a product table goods(id int,goods_name,varchar(10),price double);
CREATE TABLE `goods`(
id INT,
goods_name VARCHAR(10),
pricre DOUBLE);
-- modify goods In the table pricre by price
ALTER TABLE `goods`
CHANGE `pricre` `price` DOUBLE;
-- Use desc Check out the table details
DESC goods
-- Insert a set of elements
INSERT INTO `goods` (id,goods_name,price)
VALUES(10,'huawei',5000);
-- Insert another set of elements
INSERT INTO `goods` (id,goods_name,price)
VALUES(11,'iphone',6000);
-- Check the contents of the table
SELECT * FROM goods;
-- Add default is 100
price double not null default 100
insert matters needing attention
- The inserted data should be of the same type as the field .('30' Can be added to int in ),'abc' Can not be )
- The data length should be within the specified range .
- values The data positions listed in must correspond to the arrangement of the added columns .
- Characters and dates should be added in' 'in .
- Columns can be inserted with null values , If this field can be null ,insert into table values'null'.
- insert into table_name( Name ...) values (),(),(), Form multiple records .
- If you add data to all fields in the table , You can not write the previous field name .
- Use of default values , When a field value is not given , If there is a default value, the default value will be added , Otherwise, the report will be wrong .( If a column , Is not specified not null, When adding data , If no value is given, it will default to null )
边栏推荐
- DependencyManagement 和 Dependencies
- untiy 重置动画
- 项目实训11——对数据库的定时备份
- 200 c language words, please collect!
- [Interface tutorial] how does easycvr set platform cascading through the interface?
- Vscode common plug-ins and configurations
- 电子协会 C语言 1级 7 、画矩形
- 汇编:汇编与C派系语言混用以及对应LLDB常用指令
- Simulated 100 questions and simulated examination of G2 utility boiler stoker examination in 2022
- About string format(String format, Object... args)
猜你喜欢

Array, list, set, map, properties dependency injection format

【GMM+KDE】基于MATLAB的GMM和KDE核估计得目标跟踪仿真

数组、List、Set、Map、Properties依赖注入格式

【原创】医鹿APP九价HPV数据抓包分析

样板小作坊

IP反查域名

leetcode 130. Surrounded regions (medium)

Development and implementation of AI intelligent video analysis easycvr platform device channel batch deletion function

数据与信息资源共享平台(四)

HALCON联合C#检测表面缺陷——仿射变换(二)
随机推荐
200个C语言单词,请收藏!
Native support for the first version of arm64! Microsoft win11/10 free tool set PowerToys 0.59 release
司空见惯 - 大哲学家康德的作息时间表
js敏感信息泄露检测工具
线程池——治理线程的法宝
【GMM+KDE】基于MATLAB的GMM和KDE核估计得目标跟踪仿真
[original] analysis of nine price HPV data capture of Yilu app
软件测试入门之软件测试的概念与过程(精辟内容)
关于String.format(String format, Object... args)
期货开户有什么限制嘛?哪里最安全?
Vulnhub练习 DC-1靶机
项目实训10——对特定数据库的备份
What are the restrictions on opening futures accounts? Where is the safest?
0223 summary
"Draw the bow as strong, use the arrow as long", Manfu technology opens a new track for the data service industry
2022最新软件测试面试题常问的30道【持续更新~】
中银证券开户有什么风险吗?安全的吗?
数据与信息资源共享平台(六)
Creation of thread pool
JS sensitive information leak detection tool