-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path04.BS06-JapaneseCitiesNames.sql
More file actions
66 lines (48 loc) · 1.39 KB
/
04.BS06-JapaneseCitiesNames.sql
File metadata and controls
66 lines (48 loc) · 1.39 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
/*
Japanese Cities' Names
Query the names of all the Japanese cities in the CITY2 table. The COUNTRYCODE for Japan is JPN.
Input Format
The CITY2 table is described as follows:
+-------------+--------------+
| FILEDS | TYPE |
+-------------+--------------+
| ID | NUMBER |
| NAME | VARCHAR2(17) |
| COUNRTYCODE | VARCHAR2(3) |
| DISTRICT | VARCHAR2(20) |
| POPULATION | NUMBER |
+-------------+--------------+
*/
use hackerrank;
GO
raiserror('Now at the create procedure section ....',0,1)
GO
CREATE or ALTER PROCEDURE basicselect.proc_06jpncityname AS
select
NAME
from
basicselect.CITY2
where
COUNTRYCODE='JPN';
GO
CREATE or ALTER PROCEDURE BasicSelectTestClass.test_06jpncityname
AS
BEGIN
IF OBJECT_ID('actual') IS NOT NULL DROP TABLE actual;
IF OBJECT_ID('expected') IS NOT NULL DROP TABLE expected;
CREATE TABLE actual (
NAME varchar(17)
);
INSERT INTO actual (NAME) exec basicselect.proc_06jpncityname
CREATE TABLE expected (
NAME varchar(17)
);
INSERT INTO expected (NAME) select 'Neyagawa'
INSERT INTO expected (NAME) select 'Ageo'
INSERT INTO expected (NAME) select 'Sayama'
INSERT INTO expected (NAME) select 'Omuta'
INSERT INTO expected (NAME) select 'Tokuyama'
EXEC tSQLt.AssertEqualsTable 'expected', 'actual';
END;
GO
--exec tSQLt.Run 'BasicSelectTestClass.[test_06jpncityname]';