table

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:

Android - SQLiteOpenHelper failing to call onCreate (not creating database)

Android/SQLite FAQ: I've created an instance of a SQLiteOpenHelper object, but the onCreate method isn't getting called, what's wrong? (onCreate is not getting called, and my database tables are not being created.)

SQLite - Create a unique constraint on multiple columns (fields)

SQLite FAQ - How do I create a UNIQUE constraint on multiple fields in a SQLite database table?

Just specify the unique constraint in your create table declaration, as shown here:

A Drupal 7 table with sortable headers and pager

In my previous blog post I wrote about how to create an HTML table in a Drupal 7 module form. As promised in that tutorial, once I figured out how to make the table columns sortable, I'd share that secret recipe as well. Here then is how to make an HTML table in a Drupal 7 module/form:

A Drupal 7 form table example

If you're interested in building an HTML table with Drupal, Drupal 7 in this case, here's a quick example of how this can be done.

My Drupal "theme table" approach currently provides the following functionality:

A Drupal theme table example

Summary: A Drupal "theme table" example, where I show how to generate an HTML table from a Drupal module, using the Drupal theme function (and specifically not the theme_table function).

Create a Drupal table list view from a Drupal module

Drupal table view FAQ: How do I create a simple Drupal table view in Drupal module? I want to create a simple "list view", the sort of list view you might see in a simple CRUD application.

I just ran into this Drupal "table list" problem while creating a Drupal module, and after a lot of digging around, I found a formula that lets me display a Drupal table view like this:

SQLite alter table syntax examples

SQLite table FAQ: Can you show me how the SQLite alter table syntax works?

Currently, you can use the SQLite ALTER TABLE syntax for two purposes. You can add a column to the end of an existing SQLite database table, or you can change the name of a database table. For other changes you'll have to follow some workaround procedures (discussed below).

SQLite create table and INSERT syntax examples

SQLite database FAQ: Can you show me an example of the SQLite CREATE TABLE syntax (i.e., some SQLite CREATE TABLE examples)?

Sure, here's a small collection of SQLite CREATE TABLE examples I recently created for my SQLite tutorials:

Syndicate content