jacob andersen пре 5 година
родитељ
комит
8ee0fbe84e

+ 2
- 2
src/main/resources/application-h2.properties Прегледај датотеку

@@ -1,4 +1,4 @@
1
-spring.datasource.url=jdbc:h2:mem:testdb;Mode=Oracle
1
+spring.datasource.url=jdbc:h2:mem:test;Mode=Oracle
2 2
 spring.datasource.platform=h2
3 3
 spring.jpa.hibernate.ddl-auto=none
4
-spring.datasource.continue-on-error=true
4
+spring.datasource.continue-on-error=true

data-h2.sql → src/main/resources/data-h2.sql Прегледај датотеку

@@ -1,10 +1,19 @@
1
+INSERT INTO MOVIES (title, runtime, genre, imdb_score, rating) VALUES ('Howard the Duck',110,'Sci-Fi',4.6, 'PG');
2
+INSERT INTO MOVIES (title, runtime, genre, imdb_score, rating) VALUES ('Lavalantula',83,'Horror',4.7, 'TV-14');
3
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Starship Troopers',129,'Sci-Fi',7.2, 'PG-13');
4
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Waltz With Bashir',90,'Documentary',8.0, 'R');
5
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Spaceballs',96,'Comedy',7.1, 'PG');
6
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Monsters Inc.',92,'Animation',8.1, 'G');
7
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Braveheart',123,'Drama',6.8, 'PG-17');
8
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Forest Gump',92,'Drama',7.9, 'PG-13');
9
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Ace Ventura',70,'Comedy',5.5, 'PG-13');
10
+INSERT INTO movies (title, runtime, genre, imdb_score, rating) VALUES ('Star-Wars',90,'SCI-FI',4.6, 'PG-13');
1 11
 
2 12
 INSERT INTO HOME (ADDRESS, HOMENUMBER) VALUES ('36 E. Bayberry Rd.Savannah, GA 31404', '565-6895');
3 13
 INSERT INTO HOME (ADDRESS, HOMENUMBER) VALUES ('11 Essex Dr.Farmingdale, NY 11735', '454-4544');
4 14
 INSERT INTO HOME (ADDRESS, HOMENUMBER) VALUES ('920 Arlington Street Clifton, NJ 07011', '985-4515');
5 15
 INSERT INTO HOME (ADDRESS, HOMENUMBER) VALUES ('234 High Street, PA 19159 ', '267-3940');
6 16
 
7
-
8 17
 INSERT INTO PERSON ( LAST_NAME, FIRST_NAME, MOBILE, BIRTHDAY, HOME_ID ) VALUES ('Carbral', 'Sheeri', '230-4233', '1970-02-23', 2);
9 18
 INSERT INTO PERSON ( LAST_NAME, FIRST_NAME, MOBILE, BIRTHDAY, HOME_ID) VALUES ( 'Sharam', 'Raj', '186-5223', '1980-08-31', 3);
10 19
 INSERT INTO PERSON ( LAST_NAME, FIRST_NAME, MOBILE, BIRTHDAY, HOME_ID)VALUES ('Durand', 'Noelle', '395-6161', '1960-07-06', 1);

+ 17
- 0
src/main/resources/script.sql Прегледај датотеку

@@ -0,0 +1,17 @@
1
+SELECT * FROM MOVIES WHERE GENRE='Sci-Fi'
2
+
3
+SELECT * FROM MOVIES WHERE IMDB_SCORE >= 6.5
4
+
5
+SELECT * FROM MOVIES WHERE RUNTIME < 100 AND RATING IN('PG','G')
6
+
7
+SELECT AVG(RUNTIME), GENRE FROM MOVIES WHERE IMDB_SCORE < 7.5 GROUP BY GENRE
8
+
9
+UPDATE MOVIES
10
+SET RATING = 'R'
11
+WHERE TITLE = 'Starship Troopers'
12
+
13
+SELECT ID, RATING FROM MOVIES WHERE GENRE ='Documentary' or GENRE = 'Horror'
14
+
15
+SELECT AVG(IMDB_SCORE), MAX(IMDB_SCORE), MIN(IMDB_SCORE) FROM MOVIES HAVING COUNT(*)>1
16
+
17
+DELETE FROM MOVIES WHERE RATING = 'R'