标题:表的基本操作
包含内容:
创建表
创建主键,外键,非空,唯一,默认约束
设置表列属性自动增长
查看表结构
修改表名,字段数据类型,字段名,添加删除字段,修改字段位置
更改表的存储引擎
删除外键约束
删除表
--创建主键约束索引
mysql> create table t1(
-> col varchar(8) primary key,
-> col2 int
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> desc t1
-> ;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| col | varchar(8) | NO | PRI | NULL | |
| col2 | int(11) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql>
mysql> drop table t1;
Query OK, 0 rows affected (0.03 sec)
--设置非空约束
mysql> create table t1(
-> col int not null
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> desc t1;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| col | int(11) | NO | | NULL | |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)
mysql> drop table t1;
Query OK, 0 rows affected (0.00 sec)
mysql> create table t1(
-> col1 int primary key,
-> col2 varchar(8)
-> );
Query OK, 0 rows affected (0.03 sec)
--设置T2表的外键约束(与T1相关),key值显示为"MUL"
mysql> create table t2(
-> col1 int,
-> col2 int
-> ,
-> constraint fk_t2 foreign key(col1) references t1(col1)
-> );
Query OK, 0 rows affected (0.03 sec)
mysql> desc t2;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| col1 | int(11) | YES | MUL | NULL | |
| col2 | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)
--设置唯一性约束
mysql> create table t3(
-> col1 int unique key
-> );
Query OK, 0 rows affected (0.03 sec)
mysql> desc t3;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| col1 | int(11) | YES | UNI | NULL | |
+-------+---------+------+-----+---------+-------+
1 row in set (0.00 sec)
--设置默认值约束
mysql> create table t4(
-> col1 varchar(8) default 'xxxx',
-> col2 int
-> );
Query OK, 0 rows affected (0.00 sec)
mysql> insert into t4(col2) values(1);
Query OK, 1 row affected (0.03 sec)
mysql> select * from t4;
+------+------+
| col1 | col2 |
+------+------+
| xxxx | 1 |
+------+------+
1 row in set (0.00 sec)
--设置自动增长列
mysql> create table t5(
-> col1 int primary key auto_increment,
-> col2 varchar(8)
-> );
Query OK, 0 rows affected (0.03 sec)
mysql> desc t5;
+-------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+----------------+
| col1 | int(11) | NO | PRI | NULL | auto_increment |
| col2 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
mysql> insert into t5 values (2,'cc');
Query OK, 1 row affected (0.01 sec)
mysql> select * from t5;
+------+------+
| col1 | col2 |
+------+------+
| 2 | cc |
+------+------+
1 row in set (0.00 sec)
mysql> insert into t5(col2) values('xxx');
Query OK, 1 row affected (0.01 sec)
mysql> select * from t5;
+------+------+
| col1 | col2 |
+------+------+
| 2 | cc |
| 3 | xxx |
+------+------+
2 rows in set (0.00 sec)
mysql> show create table t1 \G
*************************** 1. row ***************************
Table: t1
Create Table: CREATE TABLE `t1` (
`col1` int(11) NOT NULL,
`col2` varchar(8) DEFAULT NULL,
PRIMARY KEY (`col1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> desc t5;
+-------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+----------------+
| col1 | int(11) | NO | PRI | NULL | auto_increment |
| col2 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+----------------+
2 rows in set (0.00 sec)
--修改表名
mysql> alter table t5 rename to t55;
Query OK, 0 rows affected (0.04 sec)
mysql> desc t5;
ERROR 1146 (42S02): Table 'zbk_db.t5' doesn't exist
mysql> desc t55;
+-------+------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+----------------+
| col1 | int(11) | NO | PRI | NULL | auto_increment |
| col2 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+----------------+
2 rows in set (0.01 sec)
--修改列的数据类型
mysql> alter table t55 modify col1 int(12);
Query OK, 2 rows affected (0.04 sec)
Records: 2 Duplicates: 0 Warnings: 0
--修改列的名称
mysql> alter table t55 change col1 col11 int(11);
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> desc t55;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| col11 | int(11) | NO | PRI | 0 | |
| col2 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
--添加表的列
mysql> alter table t55 add col3 varchar(8);
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> desc t55;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| col11 | int(11) | NO | PRI | 0 | |
| col2 | varchar(8) | YES | | NULL | |
| col3 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
--添除表的列
mysql> alter table t55 drop column col3;
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> desc t55;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| col11 | int(11) | NO | PRI | 0 | |
| col2 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
--修改表中列的位置
mysql> alter table t55 modify col2 first;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'first' at line 1
mysql> alter table t55 modify col2 varchar(8) first;
Query OK, 2 rows affected (0.03 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> desc t55;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| col2 | varchar(8) | YES | | NULL | |
| col11 | int(11) | NO | PRI | 0 | |
+-------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> show create table t55 \G
*************************** 1. row ***************************
Table: t55
Create Table: CREATE TABLE `t55` (
`col2` varchar(8) DEFAULT NULL,
`col11` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`col11`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
--修改表的存储引擎
mysql> alter table t55 engine=myisam;
Query OK, 2 rows affected (0.00 sec)
Records: 2 Duplicates: 0 Warnings: 0
mysql> show create table t55 \G
*************************** 1. row ***************************
Table: t55
Create Table: CREATE TABLE `t55` (
`col2` varchar(8) DEFAULT NULL,
`col11` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`col11`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> desc t2;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| col1 | int(11) | YES | MUL | NULL | |
| col2 | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.01 sec)
mysql> desc t1;
+-------+------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+------------+------+-----+---------+-------+
| col1 | int(11) | NO | PRI | NULL | |
| col2 | varchar(8) | YES | | NULL | |
+-------+------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> show constraint from t1 \G
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint from t1' at line 1
mysql> show index from t1 \G
*************************** 1. row ***************************
Table: t1
Non_unique: 0
Key_name: PRIMARY
Seq_in_index: 1
Column_name: col1
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null:
Index_type: BTREE
Comment:
Index_comment:
1 row in set (0.00 sec)
--查看约束索引名
mysql> show index from t2 \G
*************************** 1. row ***************************
Table: t2
Non_unique: 1
Key_name: fk_t2
Seq_in_index: 1
Column_name: col1
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
Index_comment:
1 row in set (0.00 sec)
--删除外键约束
mysql> alter table t2 drop foreign key fk_t2;
Query OK, 0 rows affected (0.02 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show index from t2 \G
*************************** 1. row ***************************
Table: t2
Non_unique: 1
Key_name: fk_t2
Seq_in_index: 1
Column_name: col1
Collation: A
Cardinality: 0
Sub_part: NULL
Packed: NULL
Null: YES
Index_type: BTREE
Comment:
Index_comment:
1 row in set (0.00 sec)
--可以看到,虽然删除了约束,但索引仍存在,需要再次删除索引
mysql> show create table t2 \G
*************************** 1. row ***************************
Table: t2
Create Table: CREATE TABLE `t2` (
`col1` int(11) DEFAULT NULL,
`col2` int(11) DEFAULT NULL,
KEY `fk_t2` (`col1`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
--删除索引
mysql> alter table t2 drop index fk_t2;
Query OK, 0 rows affected (0.04 sec)
Records: 0 Duplicates: 0 Warnings: 0
mysql> show create table t2 \G
*************************** 1. row ***************************
Table: t2
Create Table: CREATE TABLE `t2` (
`col1` int(11) DEFAULT NULL,
`col2` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1
1 row in set (0.00 sec)
mysql> desc t2
-> ;
+-------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| col1 | int(11) | YES | | NULL | |
| col2 | int(11) | YES | | NULL | |
+-------+---------+------+-----+---------+-------+
2 rows in set (0.00 sec)相关推荐
视觉语言模型对抗攻击与防御:从传统方法到多模态挑战
本文深入探讨了视觉语言模型(VLM)面临的对抗攻击与防御挑战,从传统单模态攻击到多模态威胁的演进。分析了包括FGSM、PGD等经典攻击方法,以及新兴的多模态攻击如跨模态对抗样本和越狱攻击。同时提出了跨模态一致性检查、动态防御机制等创新防御策略,并结合医疗影像诊断等实战案例,为提升AI系统安全性提供了重要见解。
mysql直接对表操作_MySQL对表的操作01
1.auto_increment 不支持varchar类型修改mysql表的字段为自增长:alter table newcar change id id int(11) not null AUTO_INCREMENT;2查看表 describe table_name;3.查看表结构的详细信息: show create table table_name;4drop table table_na...
【IPAM】Netbox docker模式版本升级
NETBOX 是一个开源的网络资源管理系统,主要用于管理 IP 地址、机架、设备、接口等网络资源信息。下面是 NETBOX 的功能、优点和缺点的详细介绍。
mysql-01库and表and记录基础操作
[库] 相关操作: CURD 增(创建一个数据库) create database 数据库名称 charset utf8; 查(查询数据库) show create database 数据库名称;(查看指定的数据库信息) show databases;(查看所有数据库) 改(修改库的编码) alter database 数据库名称 charset gbk; 删(删除数据库) drop database 数据库名称; other 切换到某个数据库 use 数据库名称; 查看当前所在数据库 sel
APB Timer验证环境搭建——学习笔记(1)
以下为个人学习笔记,如有疏漏,请大家指正补充~~APB Timer是一个简单的下行计数器,包括一个32位计数器和一组比较器,可以实现多种计时功能。包括生成一次性中断或者定时中断。
MinerU安装指南:从源码到验证的完整流程
本文详细介绍了MinerU文档转换工具的安装流程,从源码获取、依赖安装到验证步骤,提供了完整的安装指南和常见问题解决方案。特别适合技术写作者和开发者快速部署这款高效的文档转换工具,提升工作效率。
MySQL表的操作01
表在数据库中主要用来实现存储数据记录,其基本操作包括创建表、查看表、删除表和修改表。 表中的数据库对象包括: 1.列(COLUMNS):也称属性列,在具体创建表时,必须指定列的名字和它的数据类型。 2.索引(INDEXES):根据指定的数据库建立起来的顺序,提供了快速访问数据的途径。 3.触发器(TRIGGERS):指用户定义的事务命令集合,当对一个表中的数据进行插入、或删除时这组命...
ABAP OO - ALV_TREE例程
项目上比较少有用到ALV_TREE的报表功能,刚好项目上有写了一次,也查阅大量的范例,整合了一写法,给自己做一下笔记。 程序包含功能按钮,按钮下拉,F4帮助,读取选中行,字段双击触发事件,字段前置图标,更新节点,获取节点数据,获取全部子节点,递归算法,DMS模块:创建文档功能,创建文档链接,SNRO创建流水号,缓存数据,下次用户加载进来继续操作。 *&---------------------------------------------------------------------* *&a
数据库基础-01Mysql库和表的操作
数据库:一般指的是,在磁盘或者内存中存储的特定结构组织的数据(将来在磁盘上存储的一套数据库方案)mysql:数据库服务的mysqld:数据库服务的服务器端mysql本质:基于C(mysql)S(mysqld)模式的一种网络服务。
HFSS仿真3dB微带双分支定向耦合器学习笔记
设计一个3dB微带双分支定向耦合器,各端口微带线特性阻抗为50Ω,中心频率为5GHz,介质基板的介电常数9.6,基板厚度为0.8mm这里重点讲解HFSS的操作,关于理论知识后面文章更新。
第154章 点云大规模并行处理(GPU加速)
优化点云处理✨ 使用。
MySQL Day01 概述及数据库、表操作
MySQL概述及数据库、表操作 前言: JavaEE:企业级Java开发 Web 前端(页面:展示,数据!) 后台(连接点:连接数据库JDBC,链接前端(控制,控制视图跳转,给前端传递数据)) 数据库是所有软件体系中最核心的存在 DBA 1 什么是数据库? 数据库(DB DataBase) 概念:数据仓库~软件,安装在操作系统(window, linux, mac…)之上! 作用:存储数据,管理数...
【单片机】STM32F103C8T6 最小系统板原理图
STM32F103C8T6是一款基于ARM Cortex-M3内核的32位微控制器,由STMicroelectronics(ST)公司生产。它是STMicroelectronics的STM32系列微控制器中的一员,被广泛应用于嵌入式系统和电子设备中。LQFP48封装(Low-profile Quad Flat Package,48引脚)SRAM(静态随机访问存储器):20 KB。支持JTAG调试和编程接口(可选)多个通用输入/输出口(GPIO)USB接口(用于USB设备模式)内置调试和编程接口(SWD)
MySQL-01——数据库、表、数据相关操作
MySQL-01 数据库相关 show databases; create database db1 character set utf8/gbk; show create database db1; drop database db1; use db1; 表相关 create table t1(name varchar(10) , age int )engine=myisam/innodb charset=utf8/gbk; show tables; show create table t1; de
LinePhone3.2.7(android端最新版本) sip客户端
SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/
win10 跳过U8环境检测的IE WebControls.rar
win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。
01MySQL数据库和表操作
SQL常用操作整理查看表空间中所有表的大小 查看表空间中所有表的大小 比如,查询DATA_OUT表空间中所有表的大小 select segment_name,tablespace_name,bytes B, bytes/1024 KB, bytes/1024/1024 MB from user_segments where segment_type='TABLE' and tablespace_name='DATA_OUT' order by B desc; ...
深度学习工具包 DeepLearningToolbox
深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[](https://bitdeli.com/free "Bitdeli Badge")
MySQL之表(或数据库)操作语言-01
MySQL之表操作语言 MySQL的基本操作可以包括两个方面:MySQL常用语句如高频率使用的增删改查(CRUD)语句和MySQL高级功能,如存储过程,触发器,事务处理等。而这两个方面又可以细分如下: MySQL常用语句 1.表(或者数据库)的CRUD 2.表数据的CRUD,其中表数据查询使用最多,也更复杂。查询可以按照单表还是多表可以分为:单表SELECT查询和多表的联结查询(INNER JOIN, LEFT JOIN, RIGHT JOIN和FULL JOIN)以及组合查询UNION和UNION AL
假人有限元模型
假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用
mysql-复习表的基本操作01
复习数据类型 留意char(3)的案例 》枚举数据类型 enum 固定了选项的数据类型 》约束 》数据类型 设置数字类型为无符号范围的数字类型 》练习 格式,cmd连接数据库 mysql -u用户名 -p密码 或者 mysql -u用户名 -p 密文密码 mysql是否区分大小写? 不区分 退出数据库到cmd exit quit 代码,显示当前时间 select now(); 代码,显示当前...
【数据库介绍与基本操作、mysql数据类型、表的操作、mysql管理工具】01
1. mysql简介 MySQL是一个关系型数据库管理系统 由瑞典MySQL AB 公司开发,属于 Oracle 旗下产品 Mysql是一个开源免费的关系型数据库管理系统 mysql分为社区版和企业版 2. 关系型数据库 建立在关系模型基础上的数据库,借助数学中的集合代数等一些数学概念和方法,处理关系型数据库中的数据 3. Mysql的安装 windows的安装 Linux的安装 4. Mysql默认的字符集的配置(了解) ASCII码 GB2312 中文简体编码 BIG5 中文繁体编码
MySQL学习笔记-01-介绍、安装、数据库的创建、表的基本操作
文章目录MySQL介绍MySQL安装1. exe2. 免安装的方式MySQL环境的验证MySQL数据库的操作数据库的操作表的操作表的创建表的赋值数据的基本操作数据的插入删除数据修改数据数据查询运算符去除重复算数运算(+-*/)比较运算特殊的比较运算符 MySQL介绍 略 MySQL安装 1. exe 2. 免安装的方式 解压压缩包 mysql-5.7.18-winx64 “D:\Program Files\mysql-5.7.18-winx64” 启动服务(不需要操作) 注册成系统服务(开机启动
MySQL数据库01--基本操作及创建数据库表
数据库是所有软件体系中最核心的存在 数据库(DB,DataBase)概念: 数据仓库,软件,安装在操作系统( window ,linux, mac、…)之上! 可以存储大量的数据,管理数据。 一、数据库分类 1、关系型数据库:(SQL) MySQL,Oracle,sql Server,DB2,SQLlite 通过表和表之间,行和列之间的关系进行数据的存储,学员信息表,考勤表,…… 2、非关系型数据库: (NoSQL) Not Only Redis,MongDB 非关系型数据库,对象存储,通过对
MySQL学习01_数据库及表的操作
1、关于数据库的创建,查看,选择,删除 a、CREATE DATABASE database_name; //创建数据库 b、DROP DATABASE database_name; //删除数据库 c、SHOW DATABASES; //查看数据库 d、USE database_name; //选择数据库 2、关于表的操作 a、CREATE TABLE table_name(
Day01 MySQL数据库和表的操作,了解MySQL的字段类型并制作一张简单员工表
Mysql数据库操作:创建(create),展示(show),使用(use),删除(drop) 表的操作:创建(create),展示(desc),增加(add),修改(modify,rename to),使用,删除(drop) 字段类型:int,char,varchar等
数据库 --- mysql(03)-- mysql字符集、表操作(01)
包括和两个概念:字符集(CHARACTER)校对规则(COLLATION)
java监听mysql某张表的insert操作_第01问:MySQL 一次 insert 刷几次盘?
问题:MySQL 一次 insert 刷几次盘?实验:工具:pt-tools1. 先检查各个刷盘参数2. 开启 pt-tools3. 在 MySQL 中,任意表插入一行4. 观察 pt-ioprofile 的结果我们用 pt-ioprofile 跟踪 MySQL IO 的系统调用,统计了次数。可以看到本次实验中:1. MySQL 对 redo log 进行了 3 次刷盘(fsync);2. MyS...
MySQL 基础学习01:数据库操作、数据类型、表操作、数据增删改
MySQL 基础学习:数据库操作、数据类型、表操作、数据增删改
【数据库学习笔记】MySQL_01_概述,操作库,操作表,管理数据
MySQL_01 A.概述 1.数据的存储 JavaSE:定义一个变量,都存储在内存里 当程序执行完毕,这个变量就从内存中消失 JavaSE-->IO流:针对文件进行存储 a.永久保存 b.频繁的使用IO流对数据进行读写,执行效率低 2.数
391



被折叠的 条评论
为什么被折叠?



