唠叨几句:几年前的知识忘却了,整理一下笔记,提供一下方便 1.创建数据库表 设置主键 create table users( userid number(10) primary key, /*主键,自动增加*/ username varchar2(20) ); 附  删除表:drop table users; 2.创建序列自增 CREATE SEQUENCE user_Sequence INCREMENT BY 1 -- 每次加几个 START WITH 1 -- 从1开始计数 NOMAXVAL…
1.创建表 /*第一步:创建表格*/ create table t_user( id int primary key, --主键,自增长 username ), password ), type ) ); 2.创建自增序列信息 /*第二步:建立自定义的sequence*/ CREATE SEQUENCE user_sequence increment -- 每次加几个 start -- 从1开始计数 nomaxvalue -- 不设置最大值 nocycle -- 一直累加,不循环 nocache…
CREATE TABLE text(id INT(20) COMMENT '主键',NAME VARCHAR(20) COMMENT '姓名',PASSWORD VARCHAR(20) COMMENT '密码',PRIMARY KEY(id) KEY indexname (NAME))ENGINE = INNODB AUTO_INCREMENT 1 DEFAULT CHARSET = utf8 COMMENT '字符串' //注释 PRIMARY KEY(id)//主键 auto_increme…
--删除主键 alter table 表名 drop constraint 主键名 --添加主键 alter table 表名 add constraint 主键名 primary key(字段名1,字段名2……) --添加非聚集索引的主键 alter table 表名 add constraint 主键名 primary key NONCLUSTERED(字段名1,字段名2……) 新建表: create table [表名] ( ,) PRIMARY KEY , ) default \'默认值…
--删除主键 alter table 表名 drop constraint 主键名--添加主键alter table 表名 add constraint 主键名 primary key(字段名1,字段名2……)--添加非聚集索引的主键alter table 表名 add constraint 主键名 primary key NONCLUSTERED(字段名1,字段名2……) 新建表: create table [表名] ( [自动编号字段] int IDENTITY (1,1) PRIMARY…
--删除主键alter table 表名 drop constraint 主键名--添加主键alter table 表名 add constraint 主键名 primary key(字段名1,字段名2……)--添加非聚集索引的主键alter table 表名 add constraint 主键名 primary key NONCLUSTERED(字段名1,字段名2……) 新建表: create table [表名] ( [自动编号字段] int IDENTITY (1,1) PRIMARY K…
一.创建表 create table testTable ( Id numbere, name varchar2(100), age number, createTime date, primary key(Id) ) 二.创建序列 create sequence seq_test 三.创建触发器 create or replace trigger autoId before insert on testTable for each Row when (NEW.ID is null) begin…
新建表 create table [表名]([自动编号字段] int IDENTITY (1,1) PRIMARY KEY ,[字段1] nVarChar(50) default \'默认值\' null ,[字段2] ntext null ,[字段3] datetime,[字段4] money null ,[字段5] int default 0,[字段6] Decimal (12,4) default 0,[字段7] image null ,) 删除表 Drop table [表名] 插入数据…
alter table 表名 drop column ID alter table 表名 add ID int identity(1,1)…
使用sequelize-auto 生成mysql 表时主键没有 autoIncrement: true 属性,这会导致插入数据时报错.看git上面是已经解决了的,解决方法是修改查询语句模板.我用的是0.4.29最新版,不懂为何没有修复这个问题 https://github.com/sequelize/sequelize-auto/pull/359/commits/bd15c8108e6bb6058734e5ad4e4cd4ee14a8736d 在第45行,  C.extra \   改为  ,…