Skip to content

Commit

Permalink
lookup and sort by sum of page views
Browse files Browse the repository at this point in the history
  • Loading branch information
User authored and User committed Jan 30, 2021
0 parents commit e92070b
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 0 deletions.
1 change: 1 addition & 0 deletions General/.dbeaver/credentials-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
력糔㼕☈⼽�氇궅鐔亩䮟�픘䣖架ꝯᐋ⼃ᨑ儍땇⤵腱⇕䞙䤹䆓﯇燯㱆馗蕮䬳읗䰓⾯Α萩涓�㷿욕恍ג駇䱳齇⢂栟黵烼窛ꯧ≣앀뮒ꍄ㫰�槂耂銧烙ꎽ�騅ꥆ籙涫푍⭧ߦᎃ㢶㨇Ꮱ亶纻㹾ዘ鉒틣앵명䄡蘴撜쎫햎꺳
Expand Down
59 changes: 59 additions & 0 deletions General/.dbeaver/data-sources.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"folders": {},
"connections": {
"postgres-jdbc-176f7b8b950-5894084747c1b37d": {
"provider": "postgresql",
"driver": "postgres-jdbc",
"name": "samyers",
"save-password": true,
"show-system-objects": true,
"read-only": false,
"configuration": {
"host": "localhost",
"port": "5432",
"database": "samyers",
"url": "jdbc:postgresql://localhost:5432/samyers",
"home": "postgresql_client",
"type": "dev",
"properties": {
"connectTimeout": "20",
"loginTimeout": "20"
},
"provider-properties": {
"@dbeaver-show-non-default-db@": "false",
"@dbeaver-show-template-db@": "false",
"@dbeaver-show-unavailable-db@": "false",
"postgresql.dd.plain.string": "false",
"postgresql.dd.tag.string": "false"
},
"auth-model": "native"
}
},
"apache_hive2-1773aaa0714-4ccd17a4d50e30c4": {
"provider": "hive",
"driver": "apache_hive2",
"name": "localhost",
"save-password": true,
"show-system-objects": true,
"read-only": false,
"configuration": {
"host": "localhost",
"port": "10000",
"url": "jdbc:hive2://localhost:10000",
"type": "dev",
"auth-model": "native",
"handlers": {}
}
}
},
"connection-types": {
"dev": {
"name": "Development",
"color": "255,255,255",
"description": "Regular development database",
"auto-commit": true,
"confirm-execute": false,
"confirm-data-change": false
}
}
}
1 change: 1 addition & 0 deletions General/.dbeaver/project-metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"resources":{"Scripts/Script-1.sql":{"default-schema":"public","sql-editor-data-source-id":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-datasource":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-catalog":"samyers"},"Scripts/Script-2.sql":{"default-schema":"project0","sql-editor-data-source-id":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-datasource":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-catalog":"samyers"},"Scripts/Script-3.sql":{"default-schema":"project0","sql-editor-data-source-id":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-datasource":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-catalog":"samyers"},"Scripts/Script-4.sql":{"default-schema":"pageviews","sql-editor-data-source-id":"apache_hive2-1773aaa0714-4ccd17a4d50e30c4","default-datasource":"apache_hive2-1773aaa0714-4ccd17a4d50e30c4","default-catalog":"samyers"},"Scripts/Script.sql":{"default-schema":"public","sql-editor-data-source-id":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-datasource":"postgres-jdbc-176f7b8b950-5894084747c1b37d","default-catalog":"samyers"}}}
12 changes: 12 additions & 0 deletions General/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>General</name>
<comment>General DBeaver project</comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
<nature>org.jkiss.dbeaver.DBeaverNature</nature>
</natures>
</projectDescription>
21 changes: 21 additions & 0 deletions General/Scripts/Script-1.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
-- DML : data mainpulation language, used to insert, update, and delete individual records
-- DQL

create table dogs (id SERIAL, name TEXT);

alter sequence dogs_id_seq restart with 100;

insert into dogs values
(default, 'fido'),
(default, 'rex'),
(default, 'fido'),
(default, 'fido');

update dogs set name = 'blue' where id = 4;
update dogs set name = 'red' where id = 3;

delete from dogs

select * from dogs;

drop table dogs;
1 change: 1 addition & 0 deletions General/Scripts/Script-2.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from movies;
1 change: 1 addition & 0 deletions General/Scripts/Script-3.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from movies;
27 changes: 27 additions & 0 deletions General/Scripts/Script-4.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CREATE DATABASE pageviews;

USE pageviews;

CREATE TABLE pageviews (
lang STRING,
page STRING,
count INT
) ROW FORMAT DELIMITED
FIELDS TERMINATED BY ' ';

DESCRIBE pageviews;

LOAD DATA LOCAL INPATH '/home/samyers/hadoop-2.7.7/pageviews/pageviews' INTO TABLE pageviews;

SELECT * FROM pageviews;

SELECT DISTINCT(page), SUM(count) OVER (PARTITION BY page ORDER BY page DESC)
AS total_count FROM pageviews
WHERE lang = 'en' AND page != 'Main_Page' AND page != 'Special:Search' AND page != '-';







1 change: 1 addition & 0 deletions General/Scripts/Script.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
select * from cats;

0 comments on commit e92070b

Please sign in to comment.