@@ -14,10 +14,76 @@ From here you can execute SQL Statements against the table as follows
14
14
15
15
## Insert
16
16
17
+ We need to insert a single record to the table.
18
+
19
+ ``` java
20
+ movieStore
21
+ .insert()
22
+ .values(new Movie (null , " Inception" , " Christopher Nolan" ))
23
+ .execute();
24
+ ```
25
+
26
+ We need to insert multiple records to the table.
27
+
28
+ ```
29
+ movieStore
30
+ .insert()
31
+ .values(new Movie(null, "Pulp Fiction", "Quentin Tarantino"))
32
+ .values(new Movie(null, "The Matrix", "Lana Wachowski"))
33
+ .values(new Movie(null, "Dunkirk", "Christopher Nolan"))
34
+ .values(new Movie(null, "Fight Club", "David Fincher"))
35
+ .values(new Movie(null, "Interstellar", "Christopher Nolan"))
36
+ .values(new Movie(null, "The Social Network", "David Fincher"))
37
+ .execute();
38
+ ```
39
+
40
+ We need to insert a single record to the table and return inserted value.
41
+
42
+ ``` java
43
+ Movie movie = movieStore
44
+ .insert()
45
+ .values(new Movie (null , " The Dark Knight" , " Christopher Nolan" ))
46
+ .returning();
47
+ ```
48
+
17
49
## Select
18
50
51
+ We need to select all the movies
52
+
53
+ ``` java
54
+ List<Movie > movies = movieStore
55
+ .select()
56
+ .execute();
57
+ ```
58
+
59
+ We need to select the movies with where clause
60
+
61
+ ``` java
62
+ List<Movie > movies = movieStore
63
+ .select()
64
+ .where(directedBy(). eq(" Christopher Nolan" ))
65
+ .execute();
66
+ ```
67
+
19
68
## Update
20
69
70
+ Update a record
71
+
72
+ ``` java
73
+ movieStore
74
+ .update()
75
+ .set(new Movie (null , " Fight Club" , " Martyn Scorsese" ))
76
+ .where(title(). eq(" Fight Club" ))
77
+ .execute();
78
+ ```
79
+
21
80
## Delete
22
81
82
+ Delete all the records in the table
83
+
84
+ ``` java
85
+ movieStore
86
+ .delete()
87
+ .execute();
88
+ ```
23
89
0 commit comments