-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhscript_two.sh
111 lines (105 loc) · 2.85 KB
/
hscript_two.sh
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
clear
echo " ECONOMIC FACTOR"
echo""
echo "Press 1 to see all records"
echo "Press 2 to see records of specific company"
echo "Press 3 to see all records on date between selected date"
echo "Press 4 to see records of of first week"
echo "press 5 to see all name of the comapnies having highest position"
echo "Press 6 to see all name of all the companies having minimum postion"
echo "Press 7 to see closing statement of selected companies"
echo "Press 8 to see all the opening status"
echo "Press 9 to see records of the company with highest opening"
echo "Press 10 to see names and max profit of a comapny"
echo "Press 11 to see all records for the comapnies with highest and lowest opening"
echo "Press 12 to see name closing of company having max volume"
echo "Press 13 to see all records of the company having highest shares in the market"
echo "Press 14 to see records of ebay"
echo "Press X to GO TO MAIN MENU"
read var
case $var in
1) hive "market" <<EOF
use market;
select * from record;
EOF
;;
2) echo "Enter the name of the company"
read com
hive "market" <<EOF
use market;
select * from record where name="$com";
EOF
;;
3) echo "Enter the 2 dates for analysis of data"
read date
read date1
hive "market" <<EOF
use market;
select * from record where date between "$data" and "$date1";
EOF
;;
4) echo "Enter the month"
read mon
hive "market" <<EOF
use market;
select * from record where date="Ebay";
EOF
;;
5) hive "market" <<EOF
use market;
select name from record where open-close<2;
EOF
;;
6) hive "market" <<EOF
use market;
select name from record where open-close>15;
EOF
;;
7) echo "Enter the name of the company"
read nam
hive "market" <<EOF
use market;
select close from record where name="$nam";
EOF
;;
8) echo "Enter the month"
read mon
hive "market" <<EOF
use market;
select open from record;
EOF
;;
9) hive "market" <<EOF
use market;
select * from record where open>3000 ;
EOF
;;
10) hive "market" <<EOF
use market;
select name,(select max(adjusted_close) from record where open>2000) AS "Adjust" from record;
EOF
;;
11) hive "market" <<EOF
use market;
select * from record where open>2000 or close<1500;
EOF
;;
12)
hive "market" <<EOF
use market;
select name, close,(select max(volume) from record) AS "Maxvol" from record;
EOF
;;
13)
hive "market" <<EOF
use market;
select * from record;
EOF
;;
14) hive "market" <<EOF
use market;
select name from record where open-close<2;
EOF
;;
X) ./hmain_script.sh;;
esac