Changes for page Update database after retrieval
Last modified by Danniar Firdausy on 2024/09/18 20:02
From version 23.7
edited by Danniar Firdausy
on 2024/09/18 20:02
on 2024/09/18 20:02
Change comment:
There is no comment for this version
To version 23.5
edited by Danniar Firdausy
on 2024/09/11 10:38
on 2024/09/11 10:38
Change comment:
There is no comment for this version
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,6 +1,6 @@ 1 1 {{container}}{{container layoutStyle="columns"}}((( 2 2 3 -In ourprevious [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Database connectivity.intermediate-database-connectivity-sql-query||target="blank"]],we explored thebasicsof SQL queries.Now, we willtake it a step further bylearninghowto updatedatabase records immediatelyafter retrievingthem. Thisapproachisusefulformanagingstatuses,ensuringyoudootrepeatedlyread, or retrieve,the same records.Let's diveinto how this functionality works andhow to implement it within eMagiz.3 +In the previous [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Database connectivity.intermediate-database-connectivity-sql-query||target="blank"]] we discussed the fundamentals of SQL queries. In this microlearning, we will learn how you could update the record(s) in the database the moment after you have read the information from the database. This functionality can help you update a status field to ensure you won't keep reading the same record(s) repeatedly. 4 4 5 5 Should you have any questions, please get in touch with [[academy@emagiz.com>>mailto:academy@emagiz.com]]. 6 6 ... ... @@ -14,7 +14,7 @@ 14 14 15 15 == 3. Update database after retrieval == 16 16 17 -In aprevious [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Database connectivity.intermediate-database-connectivity-sql-query||target="blank"]] we discussed the fundamentals of SQL queries. In this microlearning, we will learn how you could update the record(s) in the database the moment after you have read the information from the database. This functionality can help you update a status field to ensure you won't keep reading the same record(s) repeatedly.17 +In the previous [[microlearning>>doc:Main.eMagiz Academy.Microlearnings.Intermediate Level.Database connectivity.intermediate-database-connectivity-sql-query||target="blank"]] we discussed the fundamentals of SQL queries. In this microlearning, we will learn how you could update the record(s) in the database the moment after you have read the information from the database. This functionality can help you update a status field to ensure you won't keep reading the same record(s) repeatedly. 18 18 19 19 To update the records we just read from the table, we need a slightly different update statement. As you probably remember the update statement in the previous example was written as follows {{code language="sql"}}UPDATE mytable SET changeddate = :headers[timestamp] where id = :headers[id]{{/code}}. However, with this functionality, the update statement should look like this {{code language="sql"}}UPDATE mytable SET processed = TRUE where id IN (:id){{/code}}. 20 20 ... ... @@ -26,9 +26,9 @@ 26 26 27 27 == 4. Key takeaways == 28 28 29 -* eMagiz allowsyouto execute an update statement immediatelyafter a select statement.30 -* Thisfeature isparticularlyusefulfortrackingand updating recordstatuses, preventing repeated retrieval of the same records.31 -* The update statement appliestoall rows returnedbythe selectquery, withthechangesbased on thespecified conditionsinthe where clause.29 +* eMagiz offers the option to execute an update statement right after a select statement 30 +* In the database, this can be useful when tracking the status. 31 +* The update statement will update all rows returned via the select statement, assuming they pass the where clause 32 32 33 33 == 5. Suggested additional readings == 34 34