📄 dbsetup.sql
字号:
--
-- Script of commands to create crawler database.
--
--
--
-- Usage: psql -U postgres template1 -f ./dbsetup.sql
-- where postgres is user name,
-- template1 is dbname,
-- ./dbsetup.sql is file name of the list of commands to be executed.
--
--
-- Note: The following problems were found in PostgreSQL 8.0 for Windows.
-- 1. If any statement fails with relation/column names,
-- try to surround them by double quotes or
-- check uppercase/lowercase.
-- 2. Do not use upper-case letters in a table name.
--
/* clean up old tables; must drop tables with foreign keys first due to referential integrity constraints
"delete from" and "drop table" are for a demonstration purpose only.
"drop database" will drop them all anyway. *//*\connect crawler postgresdelete from link;drop table link;*/\connect template1 postgres;
--
-- Drop the database and start from scratch
-- Alternatively, do
-- dropdb crawler
-- at command line:
Drop Database "crawler";
--
-- Selected TOC Entries:
--
--
-- Name: cralwer Type: DATABASE Owner: postgres
--
Create Database "crawler";
\connect crawler postgres
--
--
-- Name: DATABASE "crawler" Type: COMMENT Owner:
--
COMMENT ON DATABASE "crawler" IS 'link database for a Web crawler.';
create table link (source text not null, target text not null, visited timestamp with time zone, primary key (source, target) );--insert into link values('http://www.cs.usu.edu/~lim/index.html','http://www.cs.usu.edu/~lim/publication.html',current_timestamp);insert into link values('http://www.cs.usu.edu/~lim/index.html','http://www.cs.usu.edu/~lim/publication.html',to_timestamp('00010101','YYYYMMDD'));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -