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
| DROP TABLE if EXISTS Person; DROP TABLE if EXISTS Country; DROP TABLE if EXISTS Calls; CREATE TABLE If NOT EXISTS Person (id INT, name VARCHAR(15), phone_number VARCHAR(11)); CREATE TABLE If NOT EXISTS Country (name VARCHAR(15), country_code VARCHAR(3)); CREATE TABLE If NOT EXISTS Calls (caller_id INT, callee_id INT, duration INT); TRUNCATE TABLE Person; INSERT INTO Person (id, name, phone_number) VALUES ('3', 'Jonathan', '051-1234567'); INSERT INTO Person (id, name, phone_number) VALUES ('12', 'Elvis', '051-7654321'); INSERT INTO Person (id, name, phone_number) VALUES ('1', 'Moncef', '212-1234567'); INSERT INTO Person (id, name, phone_number) VALUES ('2', 'Maroua', '212-6523651'); INSERT INTO Person (id, name, phone_number) VALUES ('7', 'Meir', '972-1234567'); INSERT INTO Person (id, name, phone_number) VALUES ('9', 'Rachel', '972-0011100'); TRUNCATE TABLE Country; INSERT INTO Country (name, country_code) VALUES ('Peru', '051'); INSERT INTO Country (name, country_code) VALUES ('Israel', '972'); INSERT INTO Country (name, country_code) VALUES ('Morocco', '212'); INSERT INTO Country (name, country_code) VALUES ('Germany', '049'); INSERT INTO Country (name, country_code) VALUES ('Ethiopia', '251'); TRUNCATE TABLE Calls; INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('1', '9', '33'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('2', '9', '4'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('1', '2', '59'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('3', '12', '102'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('3', '12', '330'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('12', '3', '5'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('7', '9', '13'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('7', '1', '3'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('9', '7', '1'); INSERT INTO Calls (caller_id, callee_id, duration) VALUES ('1', '7', '7');
|