Skip to content
Advertisement

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

Find the smallest unused number in SQL Server

How do you find the smallest unused number in a SQL Server column? I am about to import a large number of manually recorded records from Excel into a SQL Server table. They all have a numeric ID (…

How can I find duplicate entries and delete the oldest ones in SQL?

I’ve got a table that has rows that are unique except for one value in one column (let’s call it ‘Name’). Another column is ‘Date’ which is the date it was added to the database. What I want to do is find the duplicate values in ‘Name’, and then delete the ones with the oldest dates in ‘Date’, leaving the

Search for “whole word match” in MySQL

I would like to write an SQL query that searches for a keyword in a text field, but only if it is a “whole word match” (e.g. when I search for “rid”, it should not match “arid”, but it should match “a …

How to execute an .SQL script file using c#

I’m sure this question has been answered already, however I was unable to find an answer using the search tool. Using c# I’d like to run a .sql file. The sql file contains multiple sql statements, some of which are broken over multiple lines. I tried reading in the file and tried executing the file using ODP.NET … however I

Advertisement