Is it possible to insert Object in a database? (Asked in PHP interview.)
SQL Server allows you to store serialized objects in JSON or XML format, and then run first-class SQL queries on them.
You can use the JSON data type of MySQL. You can use the JSON_EXTRACT to get some info from the field and filter it in the WHERE clause. Here is how to use it: JSON_EXTRACT([field], [expression])) , [expression] being how you going to extract the info from the field. Save this answer.
A database object is any defined object in a database that is used to store or reference data. Anything which we make from create command is known as Database Object.It can be used to hold and manipulate the data.
Yes, it is possible, using serialize()
.
But the answer hugely depends on context.
nobody suggested OR-mappers? interesting …
if you create your database tables so that they represent objects, you can use an object-relational mapper to store the values of your object members to the database.
for php there exists propel and many others
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With