-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathITOracle12-378.sql
More file actions
39 lines (31 loc) · 985 Bytes
/
ITOracle12-378.sql
File metadata and controls
39 lines (31 loc) · 985 Bytes
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
-- Diving in to SQL
-- Exercise for 01-22-2018
-- Here is the DDL to load the needed tables
SET ECHO ON;
DROP TABLE Subs;
DROP Table ships;
CREATE TABLE Subs
(SUB_ID varchar2(5))
;
INSERT ALL
INTO Subs (SUB_ID) VALUES ('I-166')
INTO Subs (SUB_ID) VALUES ('I-176')
INTO Subs (SUB_ID) VALUES ('I-177')
INTO Subs (SUB_ID) VALUES ('I-180')
INTO Subs (SUB_ID) VALUES ('I-182')
SELECT * FROM dual
;
CREATE TABLE ships
(Ship varchar2(13), Country varchar2(2), SUB_ID varchar2(5))
;
INSERT ALL
INTO ships (Ship, Country, SUB_ID) VALUES ('SS Fingal', 'NL', 'I-180')
INTO ships (Ship, Country, SUB_ID) VALUES ('AHS Centaur', 'AU', 'I-177')
INTO ships (Ship, Country, SUB_ID) VALUES ('HNLMS K XVI', 'NL', 'I-166')
INTO ships (Ship, Country, SUB_ID) VALUES ('USAT Liberty', 'US', 'I-166')
INTO ships (Ship, Country, SUB_ID) VALUES ('USS Seadragon', 'US', NULL)
SELECT * FROM dual
;
-- Here are the tables
SELECT * FROM ships;
SELECT * FROM subs;