-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMorgan_Assignment2.sql
More file actions
128 lines (96 loc) · 4.56 KB
/
Copy pathMorgan_Assignment2.sql
File metadata and controls
128 lines (96 loc) · 4.56 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*
Name: Gilbert Morgan
DTSC660: Data and Database Management with SQL
Assignment 2
Place your SQL code where indicated below.
DO NOT remove the Query number headers as CodeGrade uses this for grading!!
*/
--------------------------------------------------------------------------------
/* Query 1 */
--------------------------------------------------------------------------------
SELECT * FROM github;
--------------------------------------------------------------------------------
/* Query 2 */
--------------------------------------------------------------------------------
SELECT DISTINCT topic FROM github;
--------------------------------------------------------------------------------
/* Query 3 */
--------------------------------------------------------------------------------
SELECT repo_name, star_count
FROM github
ORDER BY star_count DESC;
--------------------------------------------------------------------------------
/* Query 4 */
--------------------------------------------------------------------------------
SELECT DISTINCT topic
FROM github
ORDER BY topic ASC;
--------------------------------------------------------------------------------
/* Query 5 */
--------------------------------------------------------------------------------
SELECT repo_name
FROM github
WHERE star_count > 2000;
--------------------------------------------------------------------------------
/* Query 6 */
--------------------------------------------------------------------------------
SELECT repo_name
FROM github
WHERE star_count > 3000 AND topic = '3d';
--------------------------------------------------------------------------------
/* Query 7 */
--------------------------------------------------------------------------------
SELECT repo_name
FROM github
WHERE topic IN ('aws', 'azure', 'chrome') AND star_count < 1000;
--------------------------------------------------------------------------------
/* Query 8 */
--------------------------------------------------------------------------------
SELECT user_name, repo_name, repo_link
FROM github
WHERE LOWER(repo_link) LIKE '%ext%';
--------------------------------------------------------------------------------
/* Query 9 */
--------------------------------------------------------------------------------
SELECT *
FROM github
WHERE topic = 'chrome' AND star_count > 5000;
--------------------------------------------------------------------------------
/* Query 10 */
--------------------------------------------------------------------------------
SELECT user_name, repo_name
FROM github
WHERE star_count > 1000 AND star_count < 15000;
--------------------------------------------------------------------------------
/* Query 11 */
--------------------------------------------------------------------------------
SELECT DISTINCT user_name
FROM github
WHERE star_count > 15000
ORDER BY user_name ASC;
--------------------------------------------------------------------------------
/* Query 12 */
--------------------------------------------------------------------------------
SELECT DISTINCT user_name
FROM github
WHERE user_name LIKE 'Add%' OR user_name LIKE '%on';
--------------------------------------------------------------------------------
/* Query 13 */
--------------------------------------------------------------------------------
SELECT DISTINCT topic
FROM github
WHERE star_count > 100000
ORDER BY topic ASC;
--------------------------------------------------------------------------------
/* Query 14 */
--------------------------------------------------------------------------------
SELECT topic
FROM github
WHERE star_count IS NULL;
--------------------------------------------------------------------------------
/* Query 15 */
--------------------------------------------------------------------------------
SELECT topic, user_name, star_count
FROM github
WHERE star_count BETWEEN 100000 AND 200000
AND LOWER(topic) LIKE 'a%';