File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ From here you can execute SQL Statements against the table as follows
17
17
We need to insert a single record to the table.
18
18
19
19
``` java
20
+ // INSERT INTO movie VALUES('Inception', 'Christopher Nolan')
20
21
movieStore
21
22
.insert()
22
23
.values(new Movie (null , " Inception" , " Christopher Nolan" ))
@@ -67,16 +68,34 @@ List<Movie> movies = movieStore
67
68
68
69
## Update
69
70
70
- Update a record
71
+ Update a record with where clause
71
72
72
73
``` java
74
+
75
+ // UPDATE movie
76
+ // SET title='Fight Club', directed_by='Martyn Scorsese'
77
+ // WHERE title='Fight Club'
73
78
movieStore
74
79
.update()
75
80
.set(new Movie (null , " Fight Club" , " Martyn Scorsese" ))
76
81
.where(title(). eq(" Fight Club" ))
77
82
.execute();
78
83
```
79
84
85
+ Update a record with multiple where clause
86
+
87
+ ``` java
88
+
89
+ // UPDATE movie
90
+ // SET title='Fight Club', directed_by='Martyn Scorsese'
91
+ // WHERE id=1 AND title='Fight Club'
92
+ movieStore
93
+ .update()
94
+ .set(new Movie (null , " Fight Club" , " Martyn Scorsese" ))
95
+ .where(id(). eq(1 ). and(). title(). eq(" Fight Club" ))
96
+ .execute();
97
+ ```
98
+
80
99
## Delete
81
100
82
101
Delete all the records in the table
You can’t perform that action at this time.
0 commit comments