Skip to content

Tag: sql

Execute raw SQL using Doctrine 2

I want to execute raw SQL using Doctrine 2 I need to truncate the database tables and initialize tables with default test data. Answer I found out the answer is probably: A NativeQuery lets you execute native SQL, mapping the results according to your specifications. Such a specification that describes how an…

Duplicate a record in MySQL

I have a table and I want to duplicate specific rows in the table. I know this is not the best way to do things but we are looking for a quick solution. Here’s something harder than I initially thought, all I need to do is copy an entire record to a new record in an auto-increment table in MySql

MySQL query to extract first word from a field

I would like to run a query that returns the first word only from a particular field, this field has multiple words separated by spaces, I assume I may need to carry out some regex work to accomplish this? I know how to do this using a few ways in PHP but this would best be carried out on the