• I don't know your database, but it could be argued that if users must routinely perform LIKE '%keyword%' queries on text columns just to locate the rows they are looking for, then the data model is not appropriately normalized. For example, if users are querying WHERE CustomerName LIKE '%Smith%', then there should definitely instead have FirstName and LastName columns. Or, if they are querying WHERE ProductName LIKE '%laptop%' then that suggests a ProductCategoryID column and ProductCategory table should be introduced. So, the best solution depends on the context of why they are needing to perform this text searching.

    As someone suggested earlier, one approach is to parse the contents of the text name/description column into a keyword lookup table similar to the example below. Another benefit to implementing a search keyword lookup table is that the Keywords table can be extended to contain other attributes like a count of how times the keyword was searched and additional columns for categorization and semantic type searching. For example, all of the laptop, TV, phone, etc. related keywords could be assigned to a category called 'electronics'.


    CREATE TABLE Products (
    PRIMARY KEY CLUSTERED ( ProductID )
    , ProductID INT NOT NULL
    , ProductName VARCHAR(500) NOT NULL );

    CREATE TABLE ProductKeywords (
    PRIMARY KEY CLUSTERED ( KeywordID, ProductID )
    , KeywordID INT NOT NULL
    , ProductID INT NOT NULL );

    CREATE TABLE Keywords (
    PRIMARY KEY CLUSTERED ( Keyword )
    , KeywordName VARCHAR(200) NOT NULL
    , KeywordID INT NOT NULL
    , CategoryID INT NOT NULL
    );

    -- Query Products by keyword:
    SELECT P.ProductID, P.ProductName
    FROM Keywords AS K
    JOIN ProductKeywords AS PK ON PK.KeywordID = K.KeywordID
    JOIN Products AS P ON P.ProductID = PK.ProductID
    WHERE K.KeywordName = 'laptop';

    -- Query Products by category:
    SELECT P.ProductID, P.ProductName
    FROM Keywords AS K
    JOIN ProductKeywords AS PK ON PK.KeywordID = K.KeywordID
    JOIN Products AS P ON P.ProductID = PK.ProductID
    WHERE K.CategoryID = 12;

    "Do not seek to follow in the footsteps of the wise. Instead, seek what they sought." - Matsuo Basho