发布网友 发布时间:2022-04-21 03:21
共2个回答
懂视网 时间:2022-04-10 22:47
1、建表语句
CREATE TABLE Websites(
ID INT PRIMARY KEY,
NAME VARCHAR2(30),
URL VARCHAR2(100),
alexa INT,
country VARCHAR2(30)
);
INSERT INTO Websites(ID,NAME,URL,alexa,country)VALUES(1,‘Google‘,‘http://www.google.com/‘,1,‘USA‘);
INSERT INTO Websites(ID,NAME,URL,alexa,country)VALUES(2,‘淘宝‘,‘http://www.taobao.com/‘,13,‘CN‘);
INSERT INTO Websites(ID,NAME,URL,alexa,country)VALUES(3,‘天猫‘,‘http://www.tianmao.com/‘,16,‘CN‘);
INSERT INTO Websites(ID,NAME,URL,alexa,country)VALUES(4,‘微博‘,‘http://www.weibo.com/‘,20,‘CN‘);
INSERT INTO Websites(ID,NAME,URL,alexa,country)VALUES(5,‘Facebook‘,‘http://www.facebook.com/‘,3,‘USA‘);
INSERT INTO Websites(ID,NAME,URL,alexa,country)VALUES(7,‘stackoverflow‘,‘http://www.stackoverflow.com/‘,0,‘IND‘);
CREATE TABLE access_log(
aid INT PRIMARY KEY,
site_id INT,
COUNT INT,
datetime date
);
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(1,1,45,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(2,3,100,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(3,1,230,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(4,2,10,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(5,5,205,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(6,4,13,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(7,3,220,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(8,5,545,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
INSERT INTO access_log(aid,site_id,COUNT,datetime)VALUES(9,3,201,to_timestamp(to_char(systimestamp,‘YYYY-MM-DD HH24:MI:SS.FF‘),‘YYYY-MM-DD HH24:MI:SS.FF‘));
SELECT * FROM Websites;
SELECT * FROM access_log;
2、
Oracle-Join
标签:int sys tab into ace arc 天猫 try websites
热心网友 时间:2022-04-10 19:55
给你copy一段,自己看: