码迷,mamicode.com
首页 > 数据库 > 详细

Oracle-Join

时间:2019-05-04 13:24:48      阅读:174      评论:0      收藏:0      [点我收藏+]

标签:int   sys   tab   into   ace   arc   天猫   try   websites   

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   

原文地址:https://www.cnblogs.com/hongwei2085/p/10808225.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!