alter table test add constraint pk_id primary key(id); CREATE sequence s_test start with 1 increment by 1; insert into test values (s_test.nextval,'...
分类:
数据库 时间:
2015-07-24 15:56:31
阅读次数:
159
在Postgresql的使用过程中发现了一个很有意思的功能,就是对于需要类似于树状结构的结果可以使用递归查询实现。比如说我们常用的公司部门这种数据结构,一般我们设计表结构的时候都是类似下面的SQL,其中parent_id为NULL时表示顶级节点,否则表示上级节点ID。CREATE TABLE DEPARTMENT (
ID INTEGER PRIMARY KEY,
NAME VARCHAR(32...
分类:
数据库 时间:
2015-07-24 09:19:16
阅读次数:
159
Hive cli vs beelineThe primary difference between the two involves how the clients connect to Hive.The Hive CLI connects directly to the Hive Driver a...
分类:
其他好文 时间:
2015-07-24 08:03:51
阅读次数:
189
1. 插入记录INSERT
方法一:
INSERT [INTO] tbl_name [(clo_name,...)] {VALUES | VALUE} ({expr | DEFAULT},...),(...),...;
例如:
CREATE TABLE users(id SMALLINT UNSIGNED PRIMARY KEY AUTO_INCREMENT, username VARCH...
分类:
数据库 时间:
2015-07-23 21:58:34
阅读次数:
153
创建数据库,创建表create database xitiuse xiti create table Student ( Sno char(3) not null primary key, Sname char(8) not null, Ssex char(2) not null, Sbirthda...
分类:
数据库 时间:
2015-07-23 21:47:20
阅读次数:
209
数据库版本:11.2.0.4
服务器版本:RedHat6.4
主库Primary:安装数据库软件及实例
备库Standby: 仅安装数据库软件一、搭设前主备库环境:
主库Primary:[oracle@oracle dbs]$ cat /home/oracle/.bash_profile
# .bash_profile# Get the aliases and functions
if [...
分类:
数据库 时间:
2015-07-23 12:07:47
阅读次数:
257
给表添加外键必须满足2个条件,1,该表的引擎必须是InnoDB,2,必须给要添加外键的字段建立索引 create table child( cid int not null auto_increment primary key, pid int, key pid(pid), cname varcha...
分类:
其他好文 时间:
2015-07-23 07:01:01
阅读次数:
133
简单介绍下MYSQL的索引类型 一、介绍一下索引的类型 Mysql常见索引有:主键索引、唯一索引、普通索引、全文索引、组合索引 PRIMARY KEY(主键索引) ALTER TABLE `table_name` ADD PRIMARY KEY ( `column` ) UNIQ...
分类:
数据库 时间:
2015-07-21 09:13:18
阅读次数:
165
如何创建数据表 ----------------\PRIMARY KEY(主键约束)-------\UNIQUE KEY(唯一约束)----------\DEFAULT(默认约束) -------------->>>数据表操作NOT NULL(非空约束)-------------/记录插入----....
分类:
其他好文 时间:
2015-07-20 21:07:33
阅读次数:
139
UNIONUNION ALL//Table AttributeCreate table student( id int unsigned not null auto_increment, name varchar(20) not null, primary key(id))ENGINE=I...
分类:
其他好文 时间:
2015-07-20 19:25:37
阅读次数:
125