table

How to search for a string in all fields of every table in a MySQL database

Here’s a cool tip: if you want to search for a text string in all fields of all tables of a MySQL database, you can use phpMyAdmin to do this very easily. Here are the steps to search every MySQL database table.

1) Select the desired database

The first step is to select the database you want to search. Don’t select a table — just select the database you want to search. (If you select a table you’ll get a different search form in Step 2.)

How to list MySQL database table column names without the table formatting

If you want to list all of the MySQL database table column names (field names) as a simple list of names, with each column name listed on a separate line, just follow these steps.

First, start MySQL with the -sN options, like this:

$ mysql -sN -u root -p

Then execute a query like this:

Scala: A quick look at the Slick database library

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 16.9, “A quick look at the Slick database library.”

MySQL Java mappings (Decimal to BigDecimal, etc.)

As I get back into working with a MySQL database in a Java (Scala, actually) development project and also in adding functionality to Cato, I found these MySQL to Java data type mappings, via this link:

MySQL syntax examples - create table, primary key, foreign key

Just a quick note here today that if you need some example MySQL database tables, you can use these. I created them for some experiments I ran last night. They show the MySQL create table, primary key, and foreign key syntax:

A MySQL ‘create table’ syntax example

I used to use MySQL every day for years, but over the last two years I haven't used it much. Today I needed to create a MySQL database table, and had to wonder for a few moments what the MySQL CREATE TABLE syntax was. Fortunately I have plenty of examples out here.

Here's a quick example of a MySQL "users" table: