-
Notifications
You must be signed in to change notification settings - Fork 53
/
表创建.txt
executable file
·60 lines (54 loc) · 1.48 KB
/
表创建.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
sqlite可直接使用(数据库文件urls.sqlite),无需重复创建,但需保证数据库可写(chmod 666 urls.sqlite;chown www:www urls.sqlite)
----mysql数据库----
主表创建
CREATE TABLE main(
aid int primary key not null auto_increment,
id int,
url varchar(4000) binary,
shortened varchar(10) binary,
count int,
ip varchar(100) binary,
area varchar(300) binary,
create_time varchar(30) binary,
last_time varchar(30) binary,
user_agent varchar(300) binary,
referer varchar(4000) binary);
日志表创建
CREATE TABLE log(
aid int primary key not null auto_increment,
url varchar(4000) binary,
shortened varchar(200) binary,
ip varchar(100) binary,
area varchar(300) binary,
time varchar(30) binary,
user_agent varchar(300) binary,
referer varchar(4000) binary);
----mysql数据库----
----oracle数据库----
不加引号oracle会把表名、字段名转换为大写
主表创建
CREATE TABLE "main"(
"aid" int GENERATED ALWAYS AS IDENTITY,
"id" int,
"url" varchar(4000),
"shortened" varchar(10),
"count" int,
"ip" varchar(100),
"area" varchar(300),
"create_time" varchar(30),
"last_time" varchar(30),
"user_agent" varchar(300),
"referer" varchar(4000));
插入一条数据,否则重复判断会报错
INSERT INTO "main" ("id") VALUES (1)
日志表创建
CREATE TABLE "log"(
"aid" int GENERATED ALWAYS AS IDENTITY,
"url" varchar(4000),
"shortened" varchar(200),
"ip" varchar(100),
"area" varchar(300),
"time" varchar(30),
"user_agent" varchar(300),
"referer" varchar(4000));
----oracle数据库----